How to Increase Memory Limit in WordPress

HomeWordPressHow to Increase Memory Limit in WordPress

How to Increase Memory Limit in WordPress

There are several common WordPress errors. One of the error types you might currently facing is memory exhausted. This error happens when a WordPress code requires more memory than the default allocated memory. By default, WordPress allocates memory of less than 64MB. However, there are some WordPress themes and and plugins that requires more than 64MB to work. If this is the case, you will experience an error with your WordPress.

When this type of error happens, your WordPress site is typically still can be accessed, but you won’t be able to login to dashboard. To fix the problem, you need to increase the memory limit of WordPress. Following is the example of the error message of memory exhausted in WordPress.

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 12288 bytes) in /var/www/vhosts/ on line 2602

Increase Memory Limit in WordPress

To increase the memory limit in WordPress, you need to edit the wp-config.php file, which is located in the WordPress site’s root directory. Add the following code right after the line that says “That’s all, stop editing! Happy blogging“.

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

Following is the example.

You can edit the wp-config.php file using any editor. Some hosting providers has a simple editor you can make use of so you don’t need to download the file for editing purpose. You can replace the memory amount according to your need. Just don’t forget to save the changes.

If the solution above doesn’t work for you, there are some possibilities. One of which, the web hosting provider you use doesn’t allow WordPress to increase PHP memory limit.

hand-picked weekly content in your inbox


related posts