25 April, 2014 — Snippets, WordPress

Increase WordPress Memory Limit

If you use WordPress often or have a lot of plugins installed you may have come across a PHP memory limit error. This happens when WordPress doesn’t have enough memory to achieve what you are trying to do.

In version 2.5 the WordPress core team added a wp-config.php option WP_MEMORY_LIMIT which allows you to configure the maximum amount of memory that can be used by PHP.

Changing this option in the wp-config.php will only affect your WordPress site and not any other PHP sites.

The default memory allocated to WordPress is 40MB for normal WordPress installations and 64MB for multisite installs. The core will also take into account the php.ini file if there is one and if this number is greater than the default 40MB allocated by WordPress the higher number will then be used.

To change the WordPress memory limit you just add the following into the wp-config.php.

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

If this doesn’t change your allocated memory limit your hosts may not allow you change this setting, if this is the case you should contact your hosting company.