Improve WordPress Site Performance by Increasing Memory Limit

If you found yourself spending too much time watching the loading icon on your WordPress website, it is time to consider a performance optimization. WordPress loves memory! Insufficient memory can lead to slow response, and in the worst case (I’ve seen quite few), WSOD – the White Screen of Death.

WordPress is PHP web application. Increasing WordPress memory limit is to increase the maximum amount of memory that can be consumed by PHP script. The more plugins you installed on WordPress, the more memory it consumes.

There are two settings related to memory limit in WordPress:

  • WP_MEMORY_LIMIT
  • WP_MAX_MEMORY_LIMIT

WP_MEMORY_LIMIT is for front-end consumption, and WP_MAX_MEMORY_LIMIT is for back-end, aka the administration area.

To modify these settings, you may need to add following lines to wp-config.php file.

For example:

/**
* File: wp-config.php 
*   Increase WordPress memory limit.
*/
// For front-end
define('WP_MEMORY_LIMIT', '256M');
// For back-end
define('WP_MAX_MEMORY_LIMIT', '256M');

You will see instant performance gain after applying this trick.

Please note that the setting is for PHP script only. It may not work if your host does not allow for increasing PHP memory limit.