WordPress memory limit The error means that a PHP process exceeds its allocated memory and appears on the screen as "Allowed memory size of 134217728 bytes exhausted". The quick solution is to raise the limit. The permanent solution is to find out which plugin or process is consuming the memory, because the higher the limit, the more the problem will only be postponed.

What does the error message say?

The number in the message is the current limit in bytes. 134217728 bytes equal 128 MB, 268435456 bytes equal 256 MB. The file path at the end of the message indicates the file that was running at the time the memory ran out. This file is not always the culprit; The memory was filled by another plugin, the last drop may have overflowed in that file. However, if the path points to the same plugin folder over and over again, that is the first suspect.

Where does the error occur?probable cause
Only in the admin panelSluggish plugin, large product or order list on the panel
When uploading imagesResizing a very large image
During import and exportLarge file processed at one time
On every pageLimit is too low or theme and plugin load is too high

Quick solution: increase the limit

Open the wp-config.php file and add these two lines above the "That's all, stop editing" line:

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

The first line sets the limit for visitor-side pages. The second line defines a higher limit for heavy operations in the admin panel. After the change, look at the Server section on the Information tab of the Site Health screen under Tools; If the PHP memory limit line shows the new value, the setting is valid.

If the limit has not changed, check the server setting

WordPress can only use as much memory as the server allows. In the hosting panel, open the PHP settings section (MultiPHP INI Editor in cPanel, PHP Settings in Plesk) and increase the memory_limit value. In shared packages, this value is often limited to 128 or 256 MB and cannot be exceeded by the customer. In this case, the option is to either upgrade the package or reduce consumption.

Permanent solution: who consumes memory?

If the error persists when the limit is 256 MB, the problem is not the limit. Proceed in this order:

  1. Open the error log and note the file path in the message for a few days.
  2. Install the Query Monitor plugin; Shows peak memory usage of each page and load by plugin.
  3. Close the suspicious plugin and measure the same page again.
  4. If the problem occurs when uploading images, check the pixel size of the uploaded file; A 6,000 pixel wide photo requires hundreds of MB of memory when producing thumbnails.

Steps to open error log WordPress debug You can find it in our article.

Example scenario

For example, in a store with 12,000 products, the stock export process is interrupted every time by a memory error. When the limit is increased from 256 MB to 512 MB, the process stops again because the plugin caches all products at once. The solution is not to increase the limit further, but to turn on the setting that splits the export into pieces of 500. When run in parts, the same process is completed with 128 MB.

Memory error may turn into error 500

On sites where error display is disabled, a memory overflow does not write a message to the screen; the visitor sees a blank page or a 500 error. If this is the symptom WordPress 500 error The error logging step in the guide shows you the real reason.

Common mistakes

  • Adding the line to the end of the file: Definitions written after the "stop editing" line are not taken into account.
  • Doubling the limit with each error: If there is a leak, no value will be enough and the server will handle fewer visitors at the same time.
  • Just making do with wp-config.php: If the server limit is lower, the WordPress setting will be ineffective.
  • Loading giant images directly: Reducing the photo to around 2,000 pixels before uploading will prevent this error in the first place.

A study that finds and corrects the source of repetitive memory errors, WordPress technical support It is one of the transactions within the scope of

How many MB memory is enough for WordPress?

A simple corporate site runs on 128 MB. On sites that use WooCommerce and page builders, 256 MB is a common value.

I added the line to the wp-config.php file but the limit did not change. From where?

WordPress cannot exceed the maximum allowed by the server. If the memory_limit value is lower in the PHP setting in the hosting panel, that is the valid one.

Will setting the limit to 1024 MB solve the problem completely?

No. A plugin that leaks memory will also fill the larger limit and strain the server with simultaneous visitors. It is necessary to find the process that performs the consumption.