increase the WordPress Memory Limit

What is the Memory Limit for?

The memory limit of PHP exists to prevent the unnecessary use of RAM resources on your server. In this way, this limit prevents unnecessary memory usage from ending up bringing down your website, damaging your files, crashing your entire server, and/or consuming all the resources allocated within your server.

In other words, the PHP and WordPress memory limit works as a security control for your server. WordPress is a CMS built on PHP, so your Memory limit also depends on the PHP memory limit allocated on your server. PHP’s memory limit can be set within your server, depending on available hardware. Therefore, it is important to always be aware of how much your Hosting has available memory before contracting your plan !

However, even if you have memory available on your Server, WordPress allocates a Memory Limit for its own use. Therefore, you may need to change this limit, to allow your WordPress to consume more or less Memory on your server.


increase the WordPress Memory Limit

Top issues related to WordPress Memory Limit?

As explained earlier, WordPress has a limit (which can be changed) for memory consumption. When this limit is reached, it prevents your system from consuming more memory by blocking some resources.

In general, you shouldn’t encounter big problems with the memory limit. But sometimes some problems can occur, which is why you need to change this limit.

Among the main issues you may have with WordPress Memory Limit are:

  • Plugins not working;
  • The site is not loading;
  • White screen when trying to access the website;
  • Out of Memory Error.

Top Causes of WordPress Memory Limit Issues

Most PHP scripts are quite small and don’t usually allocate much of the server’s RAM. However, in cases of more complex programs, a larger amount of RAM may be needed. Still, unless you have demanding programs, you should hardly have problems with the Memory Limit. But if that happens, then it’s worth paying attention to the possible reasons:

  • Some plugins or themes of your WordPress may be damaged, malfunctioning, generating unnecessary processes that end up consuming a lot of WordPress memory;
  • Although rare, some plugins may need a larger amount of memory to function;
  • There may be code with errors inside your WordPress, and therefore, you need to repair WordPress itself;
  • There may be some malicious program inside your server;
  • The PHP memory limit set by your Host is too low.

These are the main reasons for WordPress’s Memory Limit.

Several cases involve bugs, plugins, or WordPress code problems. So, just fix or remove these files/plugins to solve the problem. For the case of malicious files, you need to remove them or use some WordPress security system, and preferably, restore a previous backup. In case the PHP memory limit set by the Host is low, then it may be necessary to change the server or check if your host has a more “powerful” plan.

However, if everything is working correctly, and your application needs a larger amount of RAM, then the best option is to increase the WordPress Memory limit.

Read more: WordFence: Ensure the Security of Your WordPress Site

Increasing WordPress Memory Limit in Two Simple Steps!

To change and increase the WordPress memory limit, you only need to change one setting. It’s very simple and fast. To do this, you will need to locate the WordPress Settings file, and then edit it to be able to change the memory limit.

So let’s split it into two steps: Locate the configuration file and then Edit the configuration file .

Step 1 – Locating the WordPress Configuration File (wp-config.php)

The WordPress configuration file is “ wp-config.php ”. It is located in the directory where your WordPress was installed. For most servers, this means it would be in the “ public_html ” directory .

To locate it, you can use an FTP Client, cPanel, or DirectAdmin file manager, or any other way to manipulate and manage the files on your server. The important thing is that you locate the above file in your WordPress directory.

Before making any changes, we recommend that you make a backup of this file or your WordPress.

If you use cPanel or DirectAdmin Dashboard, you can follow the tutorials below. But if you prefer, you can use an FTP client, such as FileZilla, or any other way to access your server’s directories and files to locate and edit the “ wp-config.php ” file and change the WordPress memory limit.

Locating the file through cPanel

When entering your cPanel control panel, go to the file manager.

Then, already in the file manager, access the “ public_html ” directory. Unless you are using WordPress in a subdomain or other folder, WordPress files are located in this directory.

Now locate the “ wp-config.php ” file, it is with it that you can change the WordPress memory limit.

You can proceed to step 2 by editing the file directly from the cPanel File Manager Editor or you can download this file. If you choose the second option, remember to go back and upload this file at the end of step 2, replacing it with the most current one.

Locating the file through DirectAdmin

Access the DirectAdmin control panel. Then locate the “File and System Information” option, and select the “File Manager”.

Then, already in the file manager of Direct Admin, access the directory ” public_html “. Unless you are using WordPress on a subdomain or another folder, WordPress files are located in this directory.

Now locate the “ wp-config.php ” file, in it, you can change the WordPress memory limit.

You can proceed to step 2 by editing the file directly from the cPanel File Manager Editor or you can download this file. If you choose the second option, remember to go back and upload this file at the end of step 2, replacing it with the most current one.

Step 2 – Editing the wp-config.php File

You can use a code or text editor to open the “ wp-config.php ” file .

File changes can be made using any text editor (such as Notepad), or code editors (we recommend Visual Studio Code or Sublime Text ). Furthermore, several server services (such as cPanel and DirectAdmin) allow you to make the change directly through their file managers, without having to open the file externally.

Inside the wp-config.php file, you can look for a config line like the following:

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

Setting the WordPress Memory Limit

In some text/code editors, just use the shortcut “ ctrl+F ” or “ cmd+F ” to open the option to find and type by “ WP_MEMORY_LIMIT “.

Note that the number right after the ‘WP_MEMORY_LIMIT’ may be different from the example above. This is the value representing the current WordPress memory limit. That is, this is the value in MB (megabytes) that you must change to the desired limit. Don’t forget to keep the “M” after the value, such as ‘256M’.

There is also a possibility that you may not find this line within this file. For this case, you can put it before “ That’s all, stop editing! ” or “ That’s it, stop editing! ” which is at the end of the configuration file.

After making the changes, save your wp-config.php file. Replace your previous file with the current one.

Ready! You’ve just changed the WordPress Memory Limit!

What is the ideal value for the WordPress Memory Limit?

At first, you can imagine that setting a high memory limit such as 1024MB (1GB) would be interesting. However, using a high memory limit is a bad option .

As explained earlier, the memory limit is like protection for your website and your server. So, setting a WordPress memory limit too high can end up allowing a PHP script failure to end up consuming all of your server’s memory, and causing bigger problems.

Therefore, it is best to keep a WordPress memory limit as low as possible. It shouldn’t be too low, but it shouldn’t be too much either.

In case you are not aware of the values ​​to use, consider 128MB to be a suitable value and that it suits most plugins.

If you still need something above that, consider the 256MB value. With 256MB of memory, your WordPress will be able to run even the heaviest plugins .

Only increase your limit above 256MB if you are sure it is necessary and that your application will actually need more than 256MB of memory, which is rare.


WordPress Memory Limit is a very important way to protect your website or even your server!

With this tutorial, you learned that it is very simple and quick to change it! But avoid using a limit much higher than necessary, in order not to have future problems.

Also, be aware of the requirements of plugins and themes you install on your WordPress! Also, if you notice that any plugin is causing problems and consuming a lot of memory, check if it is not an error or if it is possible to replace it with another similar plugin.

Don’t forget to pay attention to your hosting server too! Your server must offer enough RAM options to run your application!


For website maintenance service contact us.

Leave a comment

echo "";