Home » WordPress » WordPress Allowed Memory Size Exhausted: How to Fix It

WordPress Allowed Memory Size Exhausted: How to Fix It

Published 2026-11-08 | WordPress

WordPress allowed memory size exhausted banner

Short answer: "Allowed memory size exhausted" means a PHP script needed more memory than your server allows. Raise the WordPress memory limit to 256 MB in wp-config.php, and if the error returns, find the plugin or task that is using too much.

The full message looks like Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes). The number is the current limit in bytes (134217728 is 128 MB). It often shows up while uploading images, updating plugins or opening a heavy admin page. If you only see a blank page instead, read WordPress white screen first.

Step 1: back up, then raise the limit in wp-config.php

Take a backup, then open wp-config.php in the site root. Add this line above the comment that says "That's all, stop editing":

define( 'WP_MEMORY_LIMIT', '256M' );

Save and reload the page. WordPress also has a separate admin limit, WP_MAX_MEMORY_LIMIT, which defaults to 256 MB and applies to heavy tasks like image processing.

Step 2: check that the server actually allows it

WP_MEMORY_LIMIT cannot exceed the limit set by PHP itself. Check the real value in Tools, Site Health, Info, Server, where it lists "PHP memory limit". If it is still 128 MB, raise it at the server level using one of these:

Where How
Hosting control panel Find "PHP settings" or "MultiPHP INI Editor" and set memory_limit to 256M
.htaccess (Apache) Add php_value memory_limit 256M
php.ini or .user.ini Add memory_limit = 256M

Some shared hosts cap memory and ignore these settings. If nothing changes, ask support to raise it.

Step 3: find what is using the memory

If the error returns even at 256 MB, something is wasteful. Turn on logging in wp-config.php:

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

Then reproduce the error and read wp-content/debug.log. The file path in the error line usually names the culprit, such as /wp-content/plugins/some-plugin/.... Turn debugging off again when you are done.

Step 4: deactivate and replace the culprit

If you can reach the dashboard, deactivate the plugin named in the log. If not, rename its folder in wp-content/plugins through FTP or the file manager. Then check whether the plugin has an update, since memory leaks are often fixed in newer versions. Keeping software current also closes security holes, see outdated CMS and plugins.

Step 5: reduce the load

  • Import or process large files in smaller batches.
  • Resize huge images before uploading them.
  • Remove page builders, sliders and backup plugins you do not use.
  • Use a current PHP version, which is usually faster and lighter.

Common mistakes

  • Editing wp-config.php below the "stop editing" line, where the setting is ignored.
  • Setting WP_MEMORY_LIMIT high while the server limit stays low.
  • Raising the limit to 2 GB instead of finding the leaking plugin.
  • Leaving debug logging on, which can grow a large log file and expose details.
  • Making changes without a backup.

Frequently Asked Questions

How much memory should WordPress have?

WordPress recommends at least 256 MB for most sites. A simple blog often runs on 128 MB, while stores and sites with page builders usually need 256 MB or 512 MB.

Why does the error come back after I raise the limit?

The limit is only a ceiling. If a plugin leaks memory or a task processes too much data at once, it will reach any limit you set. Raising it buys time, but you still need to find the cause.

Where is the error message shown?

It appears on the page as 'Fatal error: Allowed memory size of 134217728 bytes exhausted', or it hides behind a white screen or a critical error notice. Turn on debug logging to see it.

Found a mistake or still stuck? Contact us. See how we write and check these guides in our editorial policy, or read about DocumentGuy.