Skip links

Increasing WordPress Memory Limit

If you work in WordPress and need a way to increase the memory limit in WordPress to can add more resources to WordPress, there are a few ways to do that and will explain one of this ways so all you need to add a PHP constant to the wp-config.php file.

WP_MEMORY_LIMIT is a PHP constant add to the WordPress option that allows you to specify the maximum amount of memory that can be consumed by PHP where sometimes you get an error like this:

Fatal error: allowed memory size of 157286400 bytes exhausted (tried to allocate 5775295 bytes)

This code snippet will let you enable or disable debug mode with simple steps

Steps to increase WordPress memory limit:

  1. Open your host root public_html folder
  2. Open the wp-config.php file with an integrated editor, if you work localhost opens the same file using any code editor IDE.
  3. Simply add the following code
  4. Save the changes and check your pages as the custom text will show in the single product page or archive pages.

define(‘WP_MEMORY_LIMIT’, ‘256M’);

Leave a comment