We have all seen it at some point. While trying to use a feature in WordPress, this message emerges: “Fatal error: Allowed memory size of 12345678 bytes exhausted…”
WordPress memory consumption increases with the amount of modifications. The more plugins you install and keep activated , the more memory power your site needs.
As a first step of solving this, you need to know where you are at.
I use: https://wordpress.org/plugins/wp-serverinfo/ for this.
It adds a new dashboard widget, that also displays the amount of memory allocated.
Once you have determined your initial value, you should do the following to increase the Memory Limit.
Number 1: Add these lines to your wp-config.php file.
define( 'WP_MEMORY_LIMIT', '384M' ); define( 'WP_MAX_MEMORY_LIMIT', '512M' );
What numbers you put in is up to you. Me, I like to think big. However do not overdo it and put in 2056MB. Try to stay under 512MB.
However this will be useless if they are overwritten by the php.ini.
You must also edit your php.ini as follows:
Find this value: memory_limit – it will look something like this:
memory_limit = 8M
Increase this as well.
memory_limit = 384M
The php.ini is a file your hosting provider makes available for you. You cannot edit it from your WordPress installation.
Then check again via the WP Serverinfo Widget. All good? Good.
If it still says the same value (which has never occurred to me), then try editing you .htaccess file as a last resort, by adding this line to it:
php_value memory_limit 384M
Good luck and as always: Backup your files before you attempt any of this.