Troubleshooting · Explainer
What Causes "Allowed Memory Size Exhausted" in WordPress?
Short answer
The “Allowed memory size exhausted” error means a PHP script asked for more memory than the PHP memory limit allows. In WordPress that usually means the limit is set too low, a plugin or theme uses too much memory, or a heavy action such as an import or backup needs more than the site has. The error message names the limit and the file that hit it, which tells you where to look.
Key takeaways
- The error message names the limit in bytes and the file that hit it, so read it first.
- PHP defaults to a 128M memory limit, while WordPress tries for 40MB single-site and 64MB multisite.
- A low limit in the message points at the setting; a high limit that still fails points at the code.
- WP_MAX_MEMORY_LIMIT covers admin tasks, which often need more memory than front-end pages.
- Raising the limit can hide a memory leak, so find the cause before raising it again.
What does “Allowed memory size exhausted” mean in WordPress?
The “Allowed memory size exhausted” error means a PHP script asked for more memory than the PHP memory limit allows.
The full message reads “Allowed memory size of X bytes exhausted”, where X is the limit in bytes. PHP stops the script at that point, so the page fails and WordPress may show a white screen or a 500 error instead of the page.
The WordPress common errors guide puts it plainly: the error means the WordPress install does not have enough memory to do what was asked of it. The fix is to raise the limit or to cut the memory the site uses.
The error is useful because it names two things: the limit that was hit and the file that asked for the memory. Both appear in the message, so read the whole line before changing anything.
What causes the memory limit to be hit in WordPress?
Three causes sit behind most cases: a limit set too low, a plugin or theme that uses too much memory, and a heavy action that needs more than usual.
A limit set too low is the first cause. PHP ships with a default memory_limit of 128M, according to the PHP manual. Hosts can set it lower, and the WordPress handbook notes that some hosts set the PHP limit as low as 8MB (wp-config handbook).
WordPress tries to raise the memory available to it to 40MB for a single site and 64MB for multisite, per the same handbook. A site with many plugins, a large theme, or a big media library can pass 40MB on an ordinary page load.
A plugin or theme that uses too much memory is the second cause. A plugin that loads a huge data set into memory, or runs a heavy query, can use tens of megabytes on its own.
The common errors guide lists plugin conflicts, theme problems, an incompatible PHP version, the memory limit and corrupt files as the causes it finds most often in error logs.
A heavy action is the third cause. Imports, backups, migrations, bulk edits and large media uploads need far more memory than a normal page view. An import that reads a whole file into memory can pass the limit even on a healthy site.
How can you tell which cause you have?
Start with the error message itself, then note when the error appears.
The message names the limit in bytes. A limit of 8MB or 40MB is low and points at the setting. A limit of 256MB or 512MB that still gets exhausted points at the code, since a normal page should not need that much.
| Clue | Likely cause | Where to check |
|---|---|---|
| Limit in the message is 8MB or 40MB | Limit set too low | wp-config.php, php.ini |
| Error only on imports or backups | Heavy action needs more memory | Error log, action size |
| Error after a plugin update | That plugin uses more memory | Error log, plugin folder |
| Error on every page | Theme or a plugin on all pages | Debug log, plugin list |
| Error only in wp-admin | Admin-only plugin or task | WP_MAX_MEMORY_LIMIT |
| Limit is 256MB and still exhausted | Memory leak or huge data set | Error log, plugin code |
If the error appears on one action only, that action is the cause. If it appears on every page, a theme or a plugin that loads everywhere is the cause. If it started after an update, that update is the cause.
The fix steps are in our guide on how to fix Allowed Memory Size Exhausted.
What does the error log tell you about a memory error?
The error log shows the exact limit, the file that hit it, and how much memory was tried.
WordPress writes PHP errors to wp-content/debug.log when WP_DEBUG and WP_DEBUG_LOG are true in wp-config.php, with WP_DEBUG_DISPLAY set to false so errors stay out of the page HTML (WordPress debugging handbook).
The handbook warns that these constants must go before the line that reads “That's all, stop editing! Happy blogging.” in wp-config.php, and that WP_DEBUG is meant for local or staging use rather than a live site.
A log line that names a plugin folder points at that plugin. A line that names a theme folder points at the theme. A line that names a core file during an import points at the import, not at a bug in core.
The message also shows the size tried, such as “tried to allocate 20480 bytes”. A small allocation that fails means the limit was already nearly full, which points at many small uses adding up. A huge allocation points at one greedy operation.
How do the WordPress memory settings work?
WordPress has two memory settings: WP_MEMORY_LIMIT for the front end and WP_MAX_MEMORY_LIMIT for the admin area.
WP_MEMORY_LIMIT sets the maximum memory PHP may use for WordPress, and the wp-config handbook shows the line as define( 'WP_MEMORY_LIMIT', '64M' ). WordPress checks the PHP limit first and only raises it if the value you set is higher than what PHP already allows.
WP_MAX_MEMORY_LIMIT covers admin tasks, which often need more memory than a normal page view. The handbook shows it as define( 'WP_MAX_MEMORY_LIMIT', '128M' ).
Admin tasks include imports, updates and media handling, so a site that works on the front end but fails in wp-admin may need this second limit raised.
Both constants must go before wp-settings.php is loaded, which in practice means before the “That's all, stop editing!” line. The handbook notes that some hosts do not allow WordPress to raise the limit at all, in which case the host has to raise the PHP limit.
PHP's own limit sits underneath both. The PHP manual lists memory_limit with a default of 128M, and a value of -1 means no limit. Setting -1 is not a fix; it lets a runaway script use all server memory.
Why does raising the limit sometimes hide the real problem?
Raising the limit sometimes hides the real problem because it lets greedy code keep running instead of forcing you to find it.
The wp-config handbook warns about this directly: raising the limit can hide the root of the issue, which returns later as you add more plugins. A plugin that leaks memory will hit a 128MB limit, then a 256MB limit, then a 512MB limit.
The right order is to find the cause first, then raise the limit if the cause is a fair need. A large import on a healthy site is a fair need. A plugin that loads a whole database table into memory on every page is not.
If the error log names one plugin, deactivate it and see if the error clears. If it does, that plugin is the cause and the limit was only the messenger. Our guide on how to fix plugin conflicts covers the one-by-one method.
If no single plugin is at fault and the site simply has many plugins, the total may be the cause. WordPress loads every active plugin on most requests, so each one adds memory.
A site with 40 plugins needs more memory than a site with 10, and the answer may be fewer plugins rather than a higher limit. Our guide on how much RAM WordPress needs covers sizing for the whole site.
When should you ask your host to raise the limit?
Ask your host when WordPress cannot raise the limit itself, or when the limit in the error message is below what the host advertises.
Some hosts lock the PHP memory limit and ignore WP_MEMORY_LIMIT. The wp-config handbook says that in this case you should contact the host to raise the PHP memory limit. The same applies on shared hosting where php.ini is not editable.
WordPress.org recommends PHP 8.3 or greater and MySQL 8.4 or MariaDB 10.11 or greater as of November 2026 (WordPress requirements). A host running PHP 7.4, which reached end of life, can also be slower and use more memory, so an upgrade may help as well.
Give the host the exact error message, the limit it names, and the action that triggers it. That detail lets the host check whether the plan allows a higher limit or whether the plan itself is too small.
If the host raises the limit and the error returns on the same action, the code is the cause and no plan will fix it. A memory error on a media upload can also be an upload size issue, covered in our guide on how to fix Uploaded File Exceeds upload_max_filesize.
What mistakes should you avoid?
Do not set the memory limit to -1, and do not raise it without reading the error message first.
A limit of -1 removes the cap entirely, so a runaway script can use all server memory and take the whole site down. The PHP manual notes that -1 means no limit, but that is a setting for a local machine, not a live site.
Do not raise the limit in three places at once. WP_MEMORY_LIMIT, php.ini and .htaccess can each set it, and changing all three hides which one worked. Change one, check the error, and note the result.
Do not forget the admin limit. A site that loads fine on the front end but fails in wp-admin may need WP_MAX_MEMORY_LIMIT raised, not WP_MEMORY_LIMIT. The two cover different areas.
Finally, do not ignore the white screen that often comes with this error. A memory exhaustion during page load can show as a blank page, and the same log reading applies. Our guide on how to fix the WordPress white screen of death covers that case.
Frequently asked questions
Is one memory exhausted error a serious problem?
Not always. A single error during a large import may mean that one action needed more memory than usual. An error on every page means the site as a whole needs more memory or has a greedy plugin. Check the limit named in the message: a low limit points at the setting, while a high limit that still fails points at the code.
Is it safe to raise the PHP memory limit?
No, but it should be raised with care. A value such as 256M suits most sites, while -1 removes the limit entirely and lets a runaway script use all server memory. Raise the limit in one place, check the error, and find the cause if the error returns at the new limit.
How do I find my current PHP memory limit?
Yes, if you know the number. WordPress tries to give PHP 40MB on a single site and 64MB on multisite, but many hosts set the PHP limit higher, and PHP itself defaults to 128M. Check Tools, then Site Health, then Info, then Server in wp-admin, which shows the PHP memory limit your site actually has.
Can large images cause a memory exhausted error?
Sometimes. A large image uses more memory while WordPress creates thumbnails, and a batch of uploads can pass the limit together. If the error names a media file or appears only during uploads, check the upload size limits and the image sizes before raising the memory limit.
Should I ask my host to raise the memory limit?
Yes, if WordPress cannot raise the limit itself or the limit in the error is below what the host advertises. Give the host the exact error message, the limit it names, and the action that triggers it. Some hosts lock the PHP limit, so only they can raise it.
Sources
- Common WordPress Errors WordPress Developer Resources
- Editing wp-config.php WordPress Developer Resources
- Debugging in WordPress WordPress Developer Resources
- Description of core php.ini directives PHP Manual
- Requirements WordPress.org
- 500 Internal Server Error MDN Web Docs
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
