Troubleshooting

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.

WordPress Advanced About 15 min 6 steps WordPress & Websites
WordPress Allowed Memory Size Exhausted Error: causes and fix — A tired man in a small workshop office rubs his eyes at a cluttered desk with a laptop and paper invoices.

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

  1. The host's PHP memory limit is low (often 128 MB or less)
  2. WordPress itself sets a lower limit in wp-config.php
  3. A heavy plugin or theme (page builder, image tools, analytics) needs a lot of memory
  4. 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.

  1. 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.

  2. 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.

  3. 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

  4. 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.

  5. 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.

  6. 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

Terms used on this page

More WordPress & Websites problems

All problems WordPress & Websites

Last updated:

Type a few letters of the topic; spelling variants are treated as the same.