The WordPress memory limit error message is most often associated with a plugin or a theme that needs more server resources to function properly. “WordPress memory limit” is actually a poor choice of name because in fact the problem is a PHP memory limit. Find out how to increase that PHP memory limit in this tutorial.
The video below will show you step-by-step how to increase your WordPress memory limit using wp-config.php. Below the video you can read the walk-through if you prefer reading.
Increasing Your WordPress Memory Limit
There are 4 ways to get the job done:
- Call your host for support and have them do it -> by far the easiest
- Add a single line of code to your WordPress site’s wp-config.php -> medium difficulty
- Add a single line of code to your WordPress site’s htaccess file -> medium difficulty
- Add a single line of code to your host’s php.ini file -> medium difficulty
Option 2, 3, or 4 usually does the trick, but if none of those work then you will have to call your host and have them increase your memory limit.
Increase Memory Limit In WP-Config.php
Do this you will have to find and open your wp-config.php file. This file is located in the root folder of your site. Log into the root using FTP or get there via the File Manager in cPanel. Then find and open the wp-config.php file for editing.
Next, place the code you see below right above the “Stop Editing. Happy Blogging” statement.
This will set the memory limit of your website to 64 megabytes. You can change the 64 to be whatever number your plugin or theme needs, which is usually stated in the error message. I’ve seen plugins and themes need 32, 64, 96, 128 and 256 megabytes to function. I haven’t seen any requiring more than 256, but they may be out there.
Read more about this method to increase PHP memory limit in the WordPress Codex.
Increase Memory Limit In .htaccess
The .htaccess file lives in the root of your WordPress site. It is a dangerous file (more on that below). The period before the file name means that it’s a hidden file, so make sure you allow viewing of hidden files when you log into the website’s root.
If you don’t see the file and you know for sure you’ve allowed hidden files to be viewed then you can simply create the .htaccess file. Open the file to edit it and paste in the following code.
php_value memory_limit 64M
Make sure you put it on it’s own line. Again, you can change the 64 to what is needed.
The .htaccess file is a dangerous place to hang out it. One wrong character and you’re entire website will go down. Luckily, to fix the problem you should have to fix the wrong character and you’re website is back online.
So, after you make any change in your .htaccess file check your website immediately to make sure everything is as it should be.
Increase Memory Limit In php.ini
The PHP.ini file lives in the root of your server. This is usually one level above the root of your WordPress site. Inside the PHP.ini file find the line of code that says:
memory_limit = 64M ;
Yours may not say 64. Change the 64 to whatever number is needed for the plugin or theme.
If you can’t find the php.ini file in the root of your server you can create one if you’re comfortable doing so. The values you enter into your custom made php.ini file should become the default for your host.
If you want to know more about the php.ini file check out this post from the official PHP website.
If All Else Fails, Contact Your Host’s Support
If none of the above methods fix your memory limit error then it’s time to contact your host’s support. Some hosts cap memory limits at 8GB and nothing you do can change that. Only the can change it.
Keep in mind that increase the memory limit allows plugins and themes to use more of your server resources. Your server resources are limited, so you may see slower website performance by allowing plugins and themes to use more resources.
If you have any issues or need some help, please comment below!