Fixing the Failed to Load Resource Error in WordPress
March 23, 2023WordPress Can’t Upload Images? Here’s How to Fix It
March 28, 2023WordPress is an excellent choice for those looking for an intuitive and useful platform for managing and making their website; it is open-source, very flexible, and scalable, but it does have some drawbacks. Working with WordPress can be difficult for beginners at the start, especially with all the technical details it entails, one of which is the WordPress memory limit.
If your WordPress memory is exhausted very easily, it’s time to take some action.This is confusing if you don’t know what is happening. A good and easy solution to this problem is to increase the WordPress memory limit.
This tutorial will show you how to increase the WordPress memory limit relatively easily even for beginners..
About WordPress Memory Limit
If you tend to expand your website with new content, images, visual content, plugins, and various scripts, the performance of your site will decline, and eventually, you will reach the WordPress memory limit.
Then you will most likely get a PHP memory limit error often quite familiar to seasoned WordPress users. The error occurs when WordPress doesn’t have sufficient memory to complete the request you asked from it. The more plugins and scripts you use, the more memory it will use and even more memory if the plugin is poorly optimized, or if the installation takes too much memory.
Once you reach that WordPress memory limit, running your site becomes a problem. Your website requires a certain amount of memory to store all your files, including all the visual content, plugins, database, code, themes, and much more. Unfortunately, the WordPress memory limit restricts the amount of usable memory.. You can, however, increase it quite easily.
I'm interrupting the article to tell you about BeTheme, the definitive multipurpose theme. If trying to satisfy multiple clients has become more stressful than rewarding, BeTheme is the solution for that.
BeTheme’s selection of hundreds of customizable, responsive pre-built websites is the highlight and a proven stress reducer.
The customizability of the theme makes it a dream come true for its users. There are 4 types of Page Builders that you can use with it: WPBakery, BeBuilder, and Elementor among them.
And now with the Live Builder, it’s even more impressive.
Check out BeTheme and see why our users love it!
The rest of the article is down below.
Your hosting server also imposes a limitation. The provider who hosts your site will provide you with a certain amount of resources (memory) to manage all your files. Therefore the amount of memory you receive is largely dependent on your hosting provider.
You should carefully consider which provider you choose for your website. Choosing a high-quality provider makes sense, especially if you plan to expand your website over time, and consequently use more memory. For beginners, choosing more expensive plans is probably not ideal; however, with time, it might be a good option to consider expanding.
How to Increase the WordPress Memory Limit
It is relatively easy to increase the WordPress memory limit.. It is a very clear problem and the solution is also pretty clear, so there is no need to go very deep into its cause..
Three different methods are provided to fix this problem:
Method #1: Increase the PHP memory allocated to your website by changing the wp-config file
The most intuitive and relatively easy solution is basically to allocate more memory to your site than what has been allocated.
However it will only work if you still have space to increase the memory with your hosting provider.
You normally use much less memory than the provider actually offers. There are different memory limits, depending on the provider, and you need to set it regardless of what is offered.
You can find your allocation in the wp-config.php file, so access that file first. The memory limit in this file might not be the same as that of the provider. You will need to change the file in such a way that it increases the WordPress memory limit.
This file is not built-in with your website but comes separately as a part of your installation, so you need to locate it in the root folder of your WordPress site. You need to use an FTP client or other suitable file manager software.
To increase the memory to 256MB, for example, you will need to add this line into the file, right before the line that says “Happy Blogging”:
define('WP_MEMORY_LIMIT', '256M');
With this command, you will define the WordPress memory limit to 256MB, but you can change the value to your liking (as long as it is enough for your provider to handle.)
The last step is to save the file and upload it again to the server. Now you should be able to access more memory.
Method #2: Editing the PHP.ini File
If editing the wp-config.php file hasn’t worked, you can try to change your server’s settings instead of the WordPress files.
If you can access the file, then you will be able to find the file within your root folder, or where your service provider keeps it.
Go to your wp-admin folder, and try to locate the php.ini file, or the php5.ini file. If the file is there, which is unlikely, double-click on it and download it to your PC. Open it.
If the file isn’t there, then you will have to open the text editor, and open the php.ini file. Then, locate the line where your memory is specified with the memory_limit and the M values. You will need to change those lines:
If the line shows 64M as the memory limit, change it to 256M with this line:
Memory_limit = 256M
Hopefully, this will work. Please note this option doesn’t apply for shared hosting, which does not permit access to the PHP.ini file. The next method will help those who use shared hosting.
Method #3: Edit the .htaccess file
If you haven’t yet been able to change the WordPress memory limit by altering the php.ini or wp-config files, you can try changing the .htaccess file. This file will normally be a hidden file, so first you need to make the file visible within your root folder.
Then double click on the file and download it to your computer. Locate the line where your memory limit is specified, and change it by adding this passage of code; if you can’t locate it, then add it anyway:
php_valuememory_limit 512M
This will change the limit to 512MB. Next, you will have to save the file and overwrite the original. Next, refresh the FTP client, and refresh your site.
If the solution doesn’t work, then you will have to delete the line and try another solution. If it works, save the file to your root directory.
Backup Method: Contact Your Host
If you want to increase the WordPress memory limit, and the other methods haven’t worked, you can try contacting your host provider to give you a solution.
In some cases, you will not be able to do it manually, and your provider will have to do it for you. In some cases, this is the easiest and best solution, especially for those with shared hosting.
because you can’t access the php.ini file, where you can normally make the changes by yourself. If the hosting isn’t allowing you to increase the limit, then the only solution might be to change the hosting provider, or upgrading to a higher tier with your current provider.
FAQ about the WordPress memory limit
What is WordPress memory limit?
The WordPress memory limit is the most memory that your site can use all at once. It is set in the WordPress configuration file and tells your site how many resources it can use to run scripts, load plugins, and handle user requests.
How do I increase the memory limit in WordPress?
To increase WordPress's memory limit, you can edit the wp-config.php file in your WordPress root directory and add the following line of code: define('WP MEMORY LIMIT,' '256M'); This will raise the memory limit to 256MB. You can change this number to fit the needs of your website.
How much memory does WordPress need?
How much memory WordPress needs depends on how big your website is, how many plugins and themes you use, and how many people visit your site. In general, WordPress recommends a minimum of 64MB of memory, but 256MB or more may be needed for larger sites with a lot of traffic.
What happens if I exceed the WordPress memory limit?
If you use more memory than WordPress allows, your site may run slowly, have errors, or even crash. This can happen if you have too many plugins running or if you use themes that need a lot of memory. To avoid these problems, your site should use as little memory as possible and have as few plugins and themes as possible.
Can I decrease the WordPress memory limit?
Yes, you can lower the amount of memory WordPress can use if you think your site is using too much. To do this, you can change the value of WP MEMORY LIMIT in the wp-config.php file to a lower number. But keep in mind that if you lower the memory limit too much, your site might not work as well.
How do I check the current WordPress memory limit?
You can install a plugin like WP Memory Usage or use the phpinfo() function to find out how much memory WordPress is using right now. Both ways will show you how much memory your site is using and how much memory is left.
How do I optimize my WordPress site to reduce memory usage?
To optimise your WordPress site so that it uses less memory, you can start by using a light theme and turning off any plugins that you don't need. You can also make your images load faster by optimising them and using a caching plugin.
What is the recommended WordPress memory limit for a website?
How much memory a WordPress site should have depends on how big and complicated it is. A memory limit of 64MB or 128MB may be enough for small to medium-sized sites, but 256MB or more may be needed for large sites with a lot of traffic.
How do I troubleshoot memory-related issues in WordPress?
To fix WordPress problems with memory, you can start by looking at your error logs and using a plugin like Debug Bar to find memory-related errors. You can also try turning off plugins and switching to the default theme to see if that fixes the problem.
Can a low WordPress memory limit affect my website's performance?
Yes, a low WordPress memory limit can hurt the performance of your website by causing pages to load slowly, give errors, or even crash. It can also limit how many plugins and themes you can use, which can change how your website works. To avoid these problems, you should set a memory limit that fits the needs of your site and optimise it to use less memory.
Ending thoughts on the WordPress memory limit
Changing the WordPress memory limit is relatively easy if you follow these steps. The options are to change your php.ini file or your wp-config file. In some cases, you will have to alter the .htaccess file. Finally, you can contact your host to increase it for you, or change the hosting provider.
If you enjoyed reading this article on how to increase the WordPress memory limit, you should check out this one about how to use toolset.
We also wrote about a few related subjects like
how to redirect 404 to homepage,
how to downgrade WordPress,
how to install google tag manager on WordPress,
how to embed a google form in WordPress,
how to see the current WordPress version and
how to change the author in WordPress.