WP Max Memory Limit: Comprehensive Guide

Home » Documentation » WP Max Memory Limit: Comprehensive Guide

Managing memory allocation is crucial for WordPress performance. The WP Max Memory Limit setting governs the maximum memory PHP can use during WordPress execution. Properly configuring it ensures your site runs smoothly, even under heavy load.

Understanding WP Max Memory Limit

The WP Max Memory Limit defines the upper limit of memory available to PHP scripts. By default, WordPress sets this limit to 256MB. 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.

Why Adjust the WP Max Memory Limit?

  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.

How to Change WP Max Memory Limit

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

Step 1: Access wp-config.php

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.

Step 2: Edit wp-config.php

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.

Step 3: Save and Upload

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

Verifying the New Memory Limit

Whenever your site syncs up to your Scanfully Dashboard you’ll see this change in the Site Health settings of your site. Alternatively, you can use a plugin like WP Memory Usage if you can’t wait for the sync to finish. This plugin displays the current memory limit and usage in the WordPress dashboard.

WP Max Memory Limit vs. WP Memory Limit

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

WP Memory Limit

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' );

WP Max Memory Limit

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.

Interaction Between the Two

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.