The message looks scary, but it is one of the most useful errors WordPress can show you. It tells you exactly how much memory was allowed, how much more was needed, and which file asked for it. Most guides tell you to copy one line into wp-config.php and move on. That works sometimes. Other times it only hides the real problem until it comes back, bigger.
This guide reads the error the way a developer does, one clue at a time, so you can tell when raising the limit is the right fix and when it is not.
Read the Error Before You Change Anything
A typical memory error looks like the example below. You may see it on a white screen, in an email from WordPress recovery mode, or in your server's error log.
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /home/site/public_html/wp-content/plugins/example-plugin/includes/class-import.php on line 212
There are three clues in that one line. The first number is the limit that was reached, written in bytes. The second number is how much extra memory PHP tried to take at that moment. And the file path at the end shows which plugin, theme or part of WordPress was running when memory ran out.
The first number is the most important, because it tells you which limit you actually hit. The table below translates the most common values.
| Number in the error | Equal to | What it usually means |
|---|---|---|
| 41943040 | 40 MB | WordPress's own default limit, set when nothing else is configured |
| 67108864 | 64 MB | An old hosting default or the WordPress default on multisite |
| 134217728 | 128 MB | The standard PHP default on many servers |
| 268435456 | 256 MB | The WordPress admin limit, or a limit someone already raised |
| 536870912 | 512 MB | A high limit that a normal site should rarely reach |
| 1073741824 | 1 GB | Almost always a bug or a loop, not a real need for memory |
The second number matters too. If PHP tried to take only a few kilobytes more, the site was just over the line and a higher limit may solve it. If it tried to take many megabytes at once, something is loading a very large thing, such as a huge image, a big import file or a database query that returns thousands of rows.
How Much Memory a WordPress Site Really Needs Today
Memory limits on hosting have grown a lot. Hostinger, for example, lists a PHP memory limit of 1,024 MB even on its cheapest shared plan, in limits it updated at the end of October. WooCommerce, which is one of the heaviest plugins most sites run, asks for 256 MB or more in its server requirements, last updated in May.
That gives you a simple way to judge your error. A small business site or blog usually runs fine with 128 to 256 MB. A WooCommerce store, a membership site or a site built with a heavy page builder may need 256 to 512 MB. If your site still runs out at 512 MB or 1 GB, more memory is very unlikely to be the real answer.
A support thread from a WooCommerce store owner on the WordPress.org forums shows this clearly. Their store showed the memory error on every page that used WooCommerce blocks. They raised the limit to 1 GB and nothing changed. The real cause turned out to be WooCommerce's daily scheduled task, which had gone missing. Once they added it back and ran WooCommerce's own cleanup tools, the error disappeared. No extra memory was needed.
When Raising the Limit Is the Right Fix
If your error shows 40 MB, 64 MB or 128 MB, the limit is simply too low for a modern WordPress site, and raising it is the correct fix. WordPress has two settings for this. WP_MEMORY_LIMIT controls the front of the site, and WP_MAX_MEMORY_LIMIT controls the admin area, where tasks like updates and image editing need more.
Open wp-config.php in your hosting file manager and add these two lines above the line that says "That's all, stop editing". The numbers below suit most business sites.
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );
There is one catch that confuses many people. These settings cannot go higher than the limit your host sets for PHP. If your host allows only 128 MB, writing 256M in wp-config.php changes nothing. To check, go to Tools, then Site Health, open the Info tab and look at the Server section, where WordPress shows the PHP memory limit. If that number did not change, ask your host to raise it, or change it yourself in the PHP settings of your hosting panel.
Memory error keeps coming back? Our WordPress maintenance team reads your error logs, finds the plugin or task behind it and fixes the cause, not only the limit.
When Raising the Limit Only Hides the Problem
If the limit is already 256 MB or more, go back to the file path in the error. It points you to the cause far more often than people expect.
- A path inside wp-content/plugins. The folder name after plugins is the plugin that was running. Check if it has an update. If the error started right after you updated that plugin, roll back to the previous version and report it to the developer.
- A path inside wp-content/themes. The theme or a page builder template is loading too much, often a large gallery, a related posts block or a menu with hundreds of items.
- A path inside wp-includes. This is WordPress itself, but WordPress is rarely the real cause. It means WordPress was doing work for something else, such as building a huge page or loading a very large list of posts. Turn off plugins one by one on a staging copy to find which one triggers it.
- The error only happens at one moment. If it appears only during an import, a backup, an image upload or a big product update, that task is the problem. Split the import into smaller files, or run the backup at a quiet time.
Developers on forums give one piece of advice again and again. If memory use grows each time you reload a page, or the error appears at random times with different file paths, look for a loop or a stuck background task rather than a heavy plugin. The WooCommerce case above is a good example of that.
Keep the Error From Coming Back
A memory error is a warning sign, so treat it as one. Keep a short note of the date, the numbers in the error and the file path each time it happens. If the same plugin appears twice, replace it.
Keep PHP up to date as well. In October, the PHP team fixed a serious security flaw that attackers could trigger when PHP runs out of memory during a request, so an old PHP version and frequent memory errors are a bad mix. Our guide to upgrading the PHP version of your WordPress site explains how to move safely. Before any big change, take a backup as explained in our WordPress backup guide, and update plugins one at a time as our guide to updating WordPress safely shows.
If the memory error has turned into a white screen or a "critical error" message, our guides to the WordPress critical error and the 500 internal server error show how to get back into your site first. A site that keeps running close to its memory limit is usually slow too, and our WordPress speed optimization service finds the heavy parts and makes them lighter.
