Stuck With A WordPress Memory Exhausted Error? Here Are 5 Ways To Fix It
by
7-layers of Security for Your WordPress Site
Your website needs the most comprehensive security to protect it from the constant attacks it faces everyday.

You’re working on your WordPress site, maybe adding new content or a plugin. Suddenly, you hit the WordPress memory exhausted error.
Everything stops, and you’re left wondering what to do. Your site might slow down, causing anxiety about potential visitor loss.
But don’t worry; we’ve tried some easy fixes that worked for us, and they should help you too. This article will show you how to sort this out and get your site back up.
TL;DR: The WordPress memory exhausted error occurs when your site needs more memory than it’s given, which can slow things down or cause loading issues. Make sure to backup your whole site before changing core files to avoid losing data or running into site problems.
What is the WordPress memory exhausted error?
This error occurs when WordPress requires more memory than what is allocated by the server, leading to potential site slowdown or task failures. Think of trying to fit too many apps on a phone with limited storage—it simply can’t handle it all.
Servers allocate only a certain amount of memory for different tasks, and if WordPress needs more than what’s available, it can’t continue. With this error, you might not be able to complete tasks like updating your site, and parts of your website might not load at all or could slow down significantly.
What Can Trigger This Error?
Here are some common reasons why this error might occur:
- Large plugins or themes: Need extra resources during installation or updates.
- Unused plugins: Even inactive ones can consume resources.
- Big media files: Large images or videos take up significant space.
- Complex code: Inefficient or complicated code demands more resources.
- Increased traffic: A surge in visitors uses more resources, especially with limited server capacity.
- Shared hosting: Resources are shared with other sites, limiting availability.
- Multiple tasks at once: Running tasks like backups or scans simultaneously can exceed limits.
How to fix the WordPress memory exhausted error
If you’re seeing the WordPress memory exhausted error, here are some simple steps you can take to try and fix it:
1. Edit the wp-config.php file
First, use FTP to access your site’s files. Find the wp-config.php file in your root folder often named public_html or www where WordPress is installed. Open it up and add this line of code right before the line that says, “That’s all, stop editing! Happy blogging.”:
define('WP_MEMORY_LIMIT', '256M');


Save your changes and check if the error is fixed.
2. Modify the php.ini file
If you have the access, navigate to your server’s php.ini file, find the line that mentions memory_limit. Change the number to something higher, like from 64M to 256M. You might need to restart your server for the changes to take effect.

3. Edit the .htaccess file
Look for the .htaccess file in your WordPress root folder, often called public_html or www. Add this line:
php_value memory_limit 256M


Save the file and see if this resolves the issue.
4. Contact your hosting provider
If you’re on shared hosting and can’t make these changes, contact your hosting provider. They might be able to increase your memory limit. If your site is getting a lot of traffic, it might be a good time to talk about upgrading your hosting plan to get more resources.
5. Review and optimize plugins
Check out the plugins you have installed. Remove any that you don’t use to free up memory. See if any plugins are using a lot of resources by turning them off and on one by one.
How to stop this error from occurring again
Here are some easy tips to help you avoid the WordPress memory exhausted error in the future:
Keep everything updated: Regularly update WordPress, your themes, and plugins. This helps prevent problems and keeps your site secure.

Pick lightweight options: Choose plugins and themes that don’t use too much memory. This will help your site run more smoothly.
Watch your resources: Keep an eye on how much memory your site is using. This way, you can catch any issues early.
Clean up your database: Optimizing your database can make your site faster and use less memory.
Use caching: Caching stores copies of your pages, helping your site load faster.
Remove unused plugins: Get rid of plugins you don’t need and avoid having too many. This can help speed up your site.
Check your hosting plan: Make sure your hosting plan provides enough resources for your site’s needs. Upgrade if necessary.
Last words
Fixing the memory exhausted error helps keep your site running well and saves you from future headaches. By keeping up with updates and regular maintenance, you can prevent these issues before they start.
FAQs
How to fix WordPress memory exhausted error?
To fix the WordPress memory exhausted error, increase the memory limit for your site. You can do this by editing the wp-config.php file, the php.ini file, or the .htaccess file to allocate more memory. If you’re on shared hosting, contact your hosting provider for assistance.
How to increase memory_limit in WordPress?
To increase the memory limit in WordPress, add the line define(‘WP_MEMORY_LIMIT’, ‘256M’); to your wp-config.php file. Alternatively, you can modify the php.ini or .htaccess file to raise the memory limit, or reach out to your hosting provider if you need help.
What is my WordPress memory limit?
Your WordPress memory limit is the maximum amount of server memory allocated for WordPress processes. You can check this by looking at the wp-config.php file or by using a plugin that displays server and site information.
Why is not enough memory allocated to my WordPress site?
Not enough memory might be allocated to your WordPress site due to default hosting settings or resource-heavy plugins. This can also happen if your site experiences a surge in traffic, or if you are using a shared hosting plan with limited resources.
How to increase PHP memory limit?
To increase the PHP memory limit, edit your server’s php.ini file and change the memory_limit value to a higher number, such as 256M. If you don’t have access to this file, you can modify the .htaccess file or contact your hosting provider for assistance.
Category:
Share it:
You may also like

How to Whitelist an IP Address in WordPress
Whitelisting IP addresses is a manual way to ensure that certain IPs have access to your WordPress website. Ideally, you’d want your WordPress firewall to take care of that hassle…

5 Best WordPress Firewalls to Block Attacks
To keep your WordPress site secure from hackers, prevention is key. Fixing a hacked site can take a lot of time, effort, and money. Hacks can also cause your site…

Essential Website Security: Guide on How to Secure Your Website
Many website get hacked because of preventable reasons: vulnerabilities, updates not done in time, insecure passwords, and so on. In this essential website security guide, we’ll show you how to…
How can we help you?
If you’re worried that your website has been hacked, MalCare can help you quickly fix the issue and secure your site to prevent future hacks.

My site is hacked – Help me clean it
Clean your site with MalCare’s AntiVirus solution within minutes. It will remove all malware from your complete site. Guaranteed.

Secure my WordPress Site from hackers
MalCare’s 7-Layer Security Offers Complete Protection for Your Website. 300,000+ Websites Trust MalCare for Total Defence from Attacks.