How to Troubleshoot and Fix WordPress Memory Exhausted Errors (Allowed Memory Size Exhausted)

Learn how to safely diagnose and fix the “Allowed memory size exhausted” error in WordPress using wp-config.php, plugins, and hosting tools without breaking your site.

Overview: What Is a WordPress Memory Exhausted Error?

The WordPress “Allowed memory size exhausted” error appears when PHP runs out of memory while trying to load your site. It often shows as a white screen with a message similar to:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate ...)

This guide walks you through safe, step-by-step methods to increase memory, identify heavy plugins or themes, and know when to contact your host.

Before You Start: Safety Checklist

  • Have hosting access (cPanel, Plesk, or file manager) or FTP/SFTP.
  • Back up your site (files + database) via your host or a backup plugin.
  • Know your current PHP version (Dashboard ? Tools ? Site Health ? Info ? Server).

What You Should See

Once fixed, your pages should load normally without the fatal error message, and you should be able to access both the front end and the WordPress dashboard.

Step 1: Confirm You’re Seeing a Memory Exhausted Error

Sometimes this error is visible in the browser; other times it’s only in logs.

1.1 Check the Browser Error Message

Visit the page that fails to load. Look for text like:

  • Allowed memory size of 134217728 bytes exhausted
  • Fatal error: Out of memory

1.2 Check Error Logs (If the Screen Is Blank)

  1. Log in to your hosting control panel.
  2. Open Logs or Error Logs (names vary by host).
  3. Look for recent entries mentioning Allowed memory size or Out of memory.

What You Should See

You should be able to confirm that the error message explicitly references memory, not a missing file or database connection.

Step 2: Increase WordPress Memory Limit in wp-config.php

WordPress has its own memory limit, which may be lower than what your server allows. Increasing it often resolves the issue.

2.1 Access wp-config.php

  1. Connect via File Manager in your hosting panel or via FTP/SFTP.
  2. Navigate to your WordPress root folder (usually public_html or a site-specific directory).
  3. Locate the file named wp-config.php.
  4. Download a copy as a backup before editing.

2.2 Add or Adjust WP_MEMORY_LIMIT

  1. Open wp-config.php in a plain-text editor.
  2. Find the line that says:
    /* That's all, stop editing! Happy publishing. */
  3. Just above that line, add (or update) this line:
define( 'WP_MEMORY_LIMIT', '256M' );
  1. Save the file and upload it back to the server, replacing the existing file.
  2. Clear any caching plugin and your browser cache.
  3. Reload the page that was failing.

What You Should See

If the memory limit was the only issue, the error should disappear and the page should load normally. If the error persists, continue to the next steps.

Step 3: Check Server-Level PHP Memory Limit

Sometimes WordPress requests more memory than the server allows. In that case, you must raise the PHP memory_limit at the server level.

3.1 Check Current PHP Memory Limit

  1. In WordPress, go to Dashboard ? Tools ? Site Health ? Info.
  2. Expand the Server section.
  3. Look for PHP memory limit.

If it’s lower than 256M, you may need to increase it.

3.2 Increase PHP Memory Limit via Hosting Panel (If Available)

Exact names vary, but the process is similar:

  1. Log in to your hosting control panel.
  2. Open PHP Settings, MultiPHP INI Editor, or PHP Options.
  3. Find memory_limit.
  4. Increase it to 256M or 512M (if allowed by your host).
  5. Save or apply changes.
  6. Wait a minute, then refresh your site.

3.3 If You Can’t Change It Yourself

If your hosting panel doesn’t expose PHP settings, open a support ticket with your host and request:

Please increase the PHP memory_limit for my site to at least 256M (512M if possible). I’m receiving “Allowed memory size exhausted” errors in WordPress.

What You Should See

After the change, the Site Health ? Info ? Server section should show the new memory limit, and the fatal error should no longer appear.

Step 4: Identify Heavy Plugins or Themes

If increasing memory only temporarily hides the problem, a plugin, theme, or custom code may be consuming excessive resources.

Code editor showing WordPress plugin files being reviewed

4.1 Temporarily Deactivate All Plugins

  1. Log in to Dashboard ? Plugins ? Installed Plugins.
  2. Check the box at the top of the list to select all plugins.
  3. From the Bulk actions dropdown, choose Deactivate and click Apply.
  4. Test the page that was failing.

What You Should See

If the error disappears with all plugins deactivated, one of them is the cause.

4.2 Reactivate Plugins One by One

  1. Return to Plugins ? Installed Plugins.
  2. Reactivate plugins one at a time.
  3. After each activation, reload the problematic page.
  4. When the error returns, the last plugin you activated is likely the culprit.

4.3 Switch to a Default Theme

If deactivating plugins doesn’t help, test your theme:

  1. Go to Appearance ? Themes.
  2. Activate a default theme such as Twenty Twenty-Five.
  3. Test the page again.

If the error disappears, your original theme may have heavy or poorly optimized code.

Step 5: Enable Debugging for More Detail (Optional)

If the cause is still unclear, WordPress debugging can reveal which file or function is exhausting memory.

5.1 Turn On WP_DEBUG Safely

  1. Edit wp-config.php again.
  2. Find any existing WP_DEBUG lines and adjust them to:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
  1. Save and upload the file.
  2. Visit the page that triggers the error again.

WordPress will log errors to wp-content/debug.log.

5.2 Review debug.log

  1. In your file manager or FTP, open wp-content/debug.log.
  2. Scroll to the bottom for the most recent entries.
  3. Look for repeated references to a specific plugin, theme file, or custom code.

What You Should See

You should see error entries that point to particular files or functions. Share these with your developer or plugin/theme support if you need help optimizing or fixing the code.

Step 6: Clean Up and Optimize After Fixing

Once the immediate error is resolved, take a few steps to reduce the chance of it returning.

6.1 Remove or Replace Problem Plugins/Themes

  • Uninstall plugins that caused memory issues if you can live without them.
  • Look for lighter alternatives that provide the same functionality.
  • Keep only the plugins you truly need.

6.2 Keep Everything Updated

  • Update WordPress core, themes, and plugins regularly.
  • Ensure your PHP version is supported and reasonably current.

6.3 Disable Debug Mode

After you’re done troubleshooting, turn off debugging to avoid large log files:

define( 'WP_DEBUG', false );
define( 'WP_DEBUG_LOG', false );
define( 'WP_DEBUG_DISPLAY', false );

When to Contact Compass Production or Your Host

Reach out for professional help if:

  • Increasing memory and disabling plugins/themes does not resolve the error.
  • Your host refuses to raise the PHP memory limit to a reasonable level.
  • debug.log shows complex errors in custom code you’re not comfortable editing.

What You Should See After a Successful Fix

  • No more “Allowed memory size exhausted” messages.
  • Normal access to both the front end and the WordPress dashboard.
  • Stable performance when editing pages, running imports, or using page builders.

Document the changes you made (memory values, plugins removed, theme changes) so future troubleshooting is faster and easier.

Leave a Reply

readers also liked

Need Help With Your Website?

If you’re reading this because you’re planning a website—or trying to improve one—you don’t have to guess your way through it.

I offer a free 30-minute consultation where we’ll talk through your goals, your budget, and the most efficient way to get a professional website online.

Whether you need full website design, help choosing the right platform, guidance on hosting, or a clear plan you can execute yourself, I’ll give you direct, practical advice tailored to your situation.

Even if you don’t move forward with my services, you’ll leave the call knowing exactly what your next step should be.

Give us a call at
(208) 449-4466

Or give us your info and we will call you.

Give us a call at (208) 449-4466
Or give us your info and we will call you.

Get a Quote/Contact Form
By submitting this form, you acknowledge that you have read and agree to our Privacy Policy and Terms & Conditions.

Report an Issue

Flag incorrect info, broken media, or unclear steps. we review every report.

You’re reporting: {Post Title}

Content Report

By submitting this form, you acknowledge that you have read and agree to our Privacy Policy and Terms & Conditions.

Request a New Topic

Suggest a tutorial, guide, or course idea you’d like to see added. I review every submission.

Topic Request (Knowledge Base)

By submitting this form, you acknowledge that you have read and agree to our Privacy Policy and Terms & Conditions.

Websites That Work as Hard as You Do

Are you ready to grow your business?
Call (208) 449-4466 or schedule an in-person meeting today.