Changing the WordPress memory limit

Some WordPress plugins require more WP memory to run PHP scripts. Learn how to modify the wp-config.php file to increase the WordPress memory limit.

WordPress sets the PHP memory limit to 40MB by default, which means that a single PHP script can use up to 40MB of RAM. If you need more memory to run heavier plugins, you must increase the default memory limit. This article will show you how to increase WordPress's memory limits.

View WordPress memory information

To view the WordPress memory limit, follow these steps:

  1. Log in to your WordPress site with an administrator account.

  2. On the Dashboard in the left sidebar, click Tools, and then click Site Health:

  3. Click on the Info tab, and then click WordPress Constants:

  4. The WordPress memory settings are listed WordPress Constants:

How to modify WordPress memory limit

To increase WordPress memory limit, follow these steps:

  1. Login to cPanel, and then click on File Manager:

  2. On the File Manager, search for wp-config.php, and then click Go:

  3. Right click on wp-config.php, and then click Edit to edit the wp-config. php file:

  4. Search for the following lines in wp-config.php to change the memory allocation:

define( 'WP_MEMORY_LIMIT', '40M' );
  1. Change the memory from 40MB to either 64MB or 128MB. (if these lines are not available, move to the next step).

  2. Add the following lines in the wp-config. php file right above "That's all, stop editing! Happy publishing":

define( 'WP_MEMORY_LIMIT', '64M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); 
  1. Click on Save Changes to change the WP memory limits:

  2. On the WP admin dashboard, in the left sidebar, click Tools, and then click Site Health. On the info tab, click on WordPress Constants to view the memory limit changes