How To Increase WordPress Memory Limit

It’s are lesser known fact that WordPress overrides PHP’s memory_limit settings. Thus, it is possible to edit the wp-config.php file to increase WordPress’ memory allocation.

Depending on the deployment configs, wp-config.php usually is located in the /public/html directory. In the case of docker, it’s one level above wp-content directory.

A. Increasing the Administrative Memory

For admin pages, WordPress ignores PHP’s memory limit and configures its own. To change it to something other than 256 megabytes, you must set WP_MAX_MEMORY_LIMIT in wp-config.php.

To increase the memory to the administrative side of your site, add the following line in your wp-config.php:

// This sets the admin panel memory limit to 4GB
define('WP_MAX_MEMORY_LIMIT', '4G');

B. Increasing Public Memory

To increase the memory limit for your public-facing pages, open your app’s wp‑config.php and add the following line:

// This configures the public users' view memory limit to 8GB
define('WP_MEMORY_LIMIT', '8G');

Leave a Reply

Your email address will not be published. Required fields are marked *