How to fix the Memory Exhausted Error in WordPress by increasing the PHP memory limit

If you are seeing an allowed memory size exhausted error in WordPress, don’t worry because this is one of the most common WordPress errors and also one of the easiest to fix. This error occurs when your WordPress code requires more memory than the default allocated memory which is typically only 64mb. In order to fix this common error and avoid it altogether in the future, all we need to do is simply increase the PHP memory limit in WordPress. In this tutorial we will teach you how to fix the Memory Exhausted Error in WordPress by increasing the PHP memory limit.

Increase the PHP memory limit in WordPress by editing the wp-config.php file

In order to increase the PHP memory limit you will need to edit the wp-config.php file located in your WordPress site’s root folder. Download and open the wp-config.php file, copy and paste the code below just before the line that says ‘That’s all, stop editing! Happy blogging.’ After you save your changes and upload the wp-config.php file back to your server the WordPress memory limit should now be increased to 256mb instead of the default 64mb.


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

Please Note: If this solution does not work, you may need to contact your web hosting service provider to have them manually increase your PHP memory limit.


If you are having problems getting this tutorial to work please reread the tutorial and try again, if you still cannot get it to work please leave us a comment below and we will respond as soon as possible. Please do not email us with problems regarding this tutorial, only comments will be responded to.