WordPress Allowed Memory Size Exhausted Error: causes and fix
Quick answer: PHP used up the memory allowed to build a page. Add define('WP_MEMORY_LIMIT', '256M'); to wp-config.php first; if that doesn't help, raise memory_limit in your hosting control panel.

Symptoms
- "Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate ...)"
- The error appears only during a specific task: uploading an image, saving a post or updating a plugin
- "Site Health" warns that the PHP memory limit is low
Likely causes
- The host's PHP memory limit is low (often 128 MB or less)
- WordPress itself sets a lower limit in wp-config.php
- A heavy plugin or theme (page builder, image tools, analytics) needs a lot of memory
- A buggy plugin has a memory leak
Step-by-step fix
Start from step one and test again after each step; steps go from the simplest to the most technical.
-
Read the number in the error
The byte count is your current limit: 134217728 is 128 MB and 67108864 is 64 MB. If the limit is already 512 MB or more, a plugin is using far too much and raising the limit will only help briefly.
-
Set WP_MEMORY_LIMIT
Back up wp-config.php and add this line above "That's all, stop editing": define('WP_MEMORY_LIMIT', '256M'); If the error happens only in the dashboard, also add define('WP_MAX_MEMORY_LIMIT', '512M'); then reload the page.
-
Raise the limit on your host
If that has no effect, the host enforces a lower cap. In your control panel, open a tool such as "Select PHP Version" or "MultiPHP INI Editor" and set memory_limit to 256M. Some hosts instead want a php.ini or .user.ini file in the site root containing: memory_limit = 256M
-
Confirm in Site Health
In the dashboard, go to "Tools > Site Health > Info" and check "PHP memory limit" under the "Server" section. If it still shows the old value, the change didn't apply and you should ask your host to raise it.
-
Find the memory-hungry plugin
If the error happens during one specific task, deactivate the plugin related to that task and try again. Analytics, image optimization, backup and page builder plugins use the most memory; if two plugins do the same job, remove one.
-
Lighten heavy tasks
Uploading multi-megabyte images or importing hundreds of products at once needs a lot of memory. Resize images before uploading and split bulk jobs into smaller batches.
If nothing worked
If your shared hosting plan won't let you raise the limit, contact support; on many plans the cap is fixed and the real fix is a higher plan or a VPS. If the error persists even at 512 MB, more memory isn't the answer; a plugin is buggy and should be removed or replaced. Don't install "memory booster" plugins or unknown code snippets to get around the limit; the lines in wp-config.php and your host's setting are all you need.
Frequently asked questions
How much memory should I set?
256 MB is enough for a typical site, and 512 MB for a WooCommerce store or a site built with a page builder. Needing more usually signals a plugin problem, not a real need.
I added WP_MEMORY_LIMIT, so why didn't it work?
WordPress can't go above the PHP limit set by your host. If the host caps memory_limit at 128 MB, the line has no effect and you need to raise the cap in your control panel or ask support.
Related problems

There Has Been a Critical Error on This Website (WordPress)
A plugin or theme that broke after an update is almost always the cause. Open the recovery mode link in the admin email first; if there is none, rename the plugins folder via your host.

WordPress White Screen of Death
A completely blank page means PHP stopped before building the page and the error is hidden. A plugin, theme or memory limit is usually to blame; turn on WP_DEBUG first to reveal the real error.

WordPress 500 Internal Server Error
A 500 error means the server hit a problem running your site without saying why. A broken .htaccess file, a faulty plugin or low PHP memory are the usual causes; check your host's error log first.
Terms used on this page
More WordPress & Websites problems
All problems WordPress & Websites
Last updated: