Skip to content

WP Memory Limit in WordPress: What is it and how to increase it?

Alejandro Frades
Headless WordPress_ flexibilidad y rendimiento web mejorados

If you have ever encountered an error message in WordPress that says “fatal error: allowed memory size exhausted”, it means that your website has reached its allocated memory limit. This limit, known as WP Memory Limit, defines the maximum amount of memory that a PHP script can use on your WordPress site.

Why is WP Memory Limit important?

WordPress, like any other web application, needs memory to run its scripts and processes. When the memory limit is reached, WordPress functions can fail, resulting in errors, slowness or even complete site crash.

What is the default memory limit in WordPress?

The default memory limit in WordPress is usually 32 MB, although it may vary depending on the hosting. However, for most websites, especially those with plugins or complex themes, this limit may be insufficient.

How to increase the WP Memory Limit

There are several ways to increase the memory limit in WordPress:

1. Edit the wp-config.php file:

  1. Access your server via FTP or a file manager.
  2. Locate the wp-config.php file in the root of your WordPress installation.
  3. Open the file and add the following line of code before the line that says “/* That’s all, stop editing! Happy blogging. */”:
define( 'WP_MEMORY_LIMIT', '256M' );
  1. Replace ‘256M’ with the desired value (in megabytes).
  2. Save the changes in the wp-config.php.

2. Edit the .htaccess file:

  1. Access your server via FTP or a file manager.
  2. Locate the .htaccess file in the root of your WordPress installation.
  3. Open the file and add the following line of code:
php_value memory_limit 256M
  1. Replace ‘256M’ with the desired value (in megabytes).
  2. Save the changes in the .htaccess

3. Edit the php.ini file:

  1. Access your server through FTP or a file manager.
  2. Locate the php.ini file in the root of your server
  3. Open the file and look for the line that says memory_limit
  4. Change the current value to the desired value (in megabytes).
  5. Save the changes to the php.ini.

4. Contact your hosting provider:

If you do not have access to the above files or do not feel comfortable editing them, you can contact your hosting provider and request that they increase the memory limit for you.

How much should I increase the WP Memory Limit?

There is no single answer to this question, as the amount of memory needed depends on the features and complexity of your website. However, a common value is 256 MB. If you continue to experience problems, you can gradually increase the limit until the errors are resolved.

Remember: Increasing the memory limit beyond what is necessary can affect the performance of your server and other websites hosted on it.

Conclusion:

WP Memory Limit is a crucial factor for the proper functioning of your WordPress site. If you experience memory-related errors, increasing this limit may be the solution. Remember that you can do this by editing the configuration files or by contacting your hosting provider.

Autor
Alejandro Frades
Marketing Specialist
The mind behind Modular's social content. Always on top of the latest trends to take advantage of them and make the digital world more enjoyable and entertaining.

Subscribe to our Newsletter about the web world