Fix the ‘WordPress memory exhausted’ error by increasing PHP memory
The “WordPress Memory Exhausted” error is a common issue for WordPress websites, especially in new installations of WordPress. This error displays instead of your website or the WordPress dashboard when attempting to activate a new plugin or execute any other process that uses server memory such as deleting multiple posts at once.
Usually the “memory exhausted” error looks something like this:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home/public_html/wp-includes/plugin.php on line 341
This error is actually very common, and as a result, can be pretty easy to fix. The “memory exhausted” error is triggered whenever your website exceeds the default PHP memory limit. While there are a variety of ways to increase your website’s memory limit, the easiest method is by adding a single line of code to your WordPress wp-config file.
First, open your wp-config.php (located in your root WordPress directory). Then, add the following code inside the main php tag:
define('WP_MEMORY_LIMIT', '64M');
This code will automatically increase your website memory limit to 64M. If you still receive a memory exhausted error after implementing this solution, you should contact your web hosting provider. They will likely need to update their php.ini file to increase the memory limit for you.