Fix “Allowed Memory Size Exhausted” Error in WordPress (2026)
When WordPress 3.0 launched in June 2010, many bloggers on shared hosting saw upgrades fail with “Fatal error: Allowed memory size of 33554432 bytes exhausted”. The allowed memory size exhausted error still appears today, usually caused by a heavy plugin, a big import or a low hosting limit. Here’s how to fix it in 2026.

Quick answer: Add define('WP_MEMORY_LIMIT', '256M'); to wp-config.php above the line that says “That’s all, stop editing!”. If that doesn’t work, raise PHP’s memory_limit in your hosting control panel (or php.ini) to 256M or 512M. If the error continues, a plugin or theme is likely leaking memory; disable plugins to find it.
Table of Contents
What the error means
The message “Allowed memory size of X bytes exhausted (tried to allocate Y bytes)” means a PHP script needed more memory than the server allows. 33554432 bytes is 32MB, 134217728 is 128MB and 268435456 is 256MB.
Check your current memory limit
Go to Tools > Site Health > Info and open the Server and WordPress Constants sections to see the PHP memory limit and WP_MEMORY_LIMIT.
How to fix allowed memory size exhausted
1. Increase WP_MEMORY_LIMIT in wp-config.php
- Connect with your host’s File Manager or an FTP client (I prefer FileZilla).
- Download a backup of wp-config.php from your WordPress root.
- Add
define('WP_MEMORY_LIMIT', '256M');above “That’s all, stop editing!”. - For the admin area, you can also add
define('WP_MAX_MEMORY_LIMIT', '512M');.
2. Raise PHP memory_limit
- Hosting panel: most hosts (cPanel MultiPHP INI Editor, Hostinger hPanel PHP Configuration, Plesk) let you change memory_limit.
- php.ini or .user.ini: set
memory_limit = 256M. - .htaccess (Apache with mod_php only):
php_value memory_limit 256M. This causes a 500 error on servers using PHP-FPM, so remove it if the site breaks.
3. Find the memory hog
- Deactivate all plugins, then re-enable them one by one.
- Switch to a default theme temporarily.
- Use the Query Monitor plugin to see memory use per page.
- Large imports, page builders and backup plugins are common culprits.
4. Ask your host
WordPress can’t exceed the server’s PHP limit. If changes don’t stick, ask support to raise it or upgrade your plan.
Related fixes: how I fixed internal server errors and sitemap plugin memory limits.
FAQ
How much memory does WordPress need?
256MB is a comfortable limit for most sites. WordPress defaults to 40MB for the front end (64MB on multisite) if nothing higher is set.
Is it safe to increase the PHP memory limit?
Yes, within your hosting plan’s limits. Fix leaking plugins rather than raising it endlessly.
Why does the error say 128M when I set 256M?
Your host’s PHP limit is probably lower than WP_MEMORY_LIMIT. Raise memory_limit in the hosting panel.
Get our free weekly email: new tech guides and tools, no spam.
New and updated tech guides, a free tool worth bookmarking and one useful pick, once a week. No spam, unsubscribe anytime.
One email a week. Unsubscribe anytime. See our privacy policy.






I am using a wordpress installation with bbpress plugin installed in it. Most of the time memory usage is around 39 Mb, which is more than allowed 32 MB. But the page still loads and works. Should I change the memory limit to more than 32 MB? My site uses wordpress 3.5 and bbpress 2.0
When in L.A, I owe you a beer. Updating the config file worked and saved several websites for me (too late though for some others that I had to put down because I could not solve the memory issues).
Thanks
Thanks so much for helping resolve the memory limit problem i had on my site…
@steve
man, I have been trying everything. Created that small php.ini fine and worked like a charm! thanks!
I use NameCheap for hosting. I didn’t have a php.ini file anywhere, and editing .htaccess didn’t work, so I created a basic php.ini file and put it in four public_html folders that I thought might need help: wp-admin, wp-admin/includes, wp-content, wp-includes. I’m not sure where the magic spot was, and I don’t care because it’s working now :)
The content of the php.ini file was basic:
[PHP]
upload_max_filesize = 64M
memory_limit = 64M
register_globals = On
creating a small php.ini file in the wp-admin directory did the trick!
Many thanks!!
The wp-config.php setting worked best for me – I was getting this error even when trying to browse to the edit pages menu (on the site in question there are admittedly a lot of pages, but this never happened before 3.0)
Thanks!
Also, be sure to check line 23 of the /wp-includes/default-constants.php
This has been the culprit for error problems for me!
Thank you for your tips.
;)
Thanks for the fix, I needed to change the htacces the other sollutions did not work, but you saved my day :-)
Thank you for your tips.
;)
nice info, but my i know, what is the advantage if we use wp 3.0 with the older… ? i try to update my wp, but, i m scared if my db error n i lost everything (content, themes, links etc). then what should i do if i want to upgrade my wp to 3.0?
Agritwebid, you shouldn’t be doing an upgrade without a full database and plugin/theme/upload backup at the very least. There’s a lot of good tutorials on the net, maybe even on this blog. On my blog if you search for “backup” you will find mine. Yes, back up all your stuff. Then deactivate theme (by activating the original theme), deactivate your plugins and upgrade without headache usually.
Kimberly
Thanks for the tips. But for those people with a provider limiting memory access, and still having problem wi allowed memory size, simply desactivate the plugins during update and it will work fine ;)
Deactivating plugins and reactivating them after upgrade would that not after some plugins that require some setting/configuration like All in One SEO, to working properly, would not have to do the seup again after reactivation the plugins?
There will be a few plugins, usually wp-super cache that need a setting or two looked at after this – however, most plugins store their settings in the wordpress database and deactivating them does NOT harm the settings. Delete removes the settings but deactivation generally preserves them. Definitely want to deactivate theme and plugins to reduce conflicts.
Kimberly
At times it does n’t work, so here are two work around:
Edit your php.ini file to increase the memory and if that doesn’t work also, contact your host and ask them to upgrade your memory limit for your hosting account.