Skip to content

WP_MAX_MEMORY_LIMIT explained

Managing memory allocation is crucial for WordPress performance. The WP_MAX_MEMORY_LIMIT constant sets how much memory WordPress allows itself in the admin and for heavy tasks such as image processing. Configuring it properly keeps updates, imports and media uploads from running out of memory.

In the WordPress admin, and for memory-hungry tasks such as resizing images, WordPress raises PHP’s memory limit to WP_MAX_MEMORY_LIMIT. By default, WordPress sets it to 256MB, or to PHP’s own limit when that is higher. However, you can adjust it according to your site’s needs. Increasing this limit is essential for resource-intensive sites like e-commerce or high-traffic blogs.

  1. Avoid Memory Exhaustion Errors: With more memory, your site can handle complex operations without crashing.
  2. Improve Performance: Higher memory allocation enhances site speed and responsiveness.
  3. Support Plugins: Some plugins require more memory to function correctly.

Changing the WP_MAX_MEMORY_LIMIT to your preference works just like any other change to your wp-config.php file.

First, locate your wp-config.php file. You can find it in the root directory of your WordPress installation. Use an FTP client or your hosting control panel to access this file.

Next, open wp-config.php in a text editor. Add the following line to set a new memory limit:

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

In this example, we set the limit to 512MB. You can adjust the value based on your requirements.

After editing, save the wp-config.php file. Upload it back to your server if you used an FTP client.

The next time the Scanfully plugin sends its data (every 3 hours), the Site health screen shows the new value under Details, as Admin memory limit in the WordPress panel and PHP memory limit in the admin in the Server panel. If you can’t wait, a plugin like WP Memory Usage shows the current memory limit and usage in the WordPress admin.

Understanding the interaction between WP Max Memory Limit and WP Memory Limit is crucial. Here’s a breakdown:

The WP Memory Limit defines the memory allocation for WordPress core processes. By default, it’s set to 40MB for single sites and 64MB for multisites. You can adjust this limit in wp-config.php:

define( 'WP_MEMORY_LIMIT', '128M' );

The WP Max Memory Limit overrides WP Memory Limit for specific tasks like image processing. It ensures resource-heavy operations have enough memory to execute without affecting the rest of the site.

When you set both constants, WordPress uses WP Memory Limit for general operations and WP Max Memory Limit for intensive tasks. For instance, if a plugin needs more memory than the WP Memory Limit, it can utilize the WP Max Memory Limit.

In summary, both constants work together to optimize memory usage. Adjusting them ensures your site remains fast and stable under varying loads.


Configuring the WP Max Memory Limit is essential for maintaining WordPress performance. By understanding and adjusting this setting, you can prevent memory errors and enhance your site’s responsiveness. Always monitor your memory usage to ensure optimal performance.

When PHP memory limit in the admin is below 128 MB, the Site health screen shows the warning PHP memory limit in the admin is 64 MB (with your value) in the Performance area: updates, imports and image processing can run out of memory. Raise WP_MAX_MEMORY_LIMIT, or PHP’s memory_limit if your host does not let WordPress raise it. A limit of -1 (no limit) never counts as too low.