"Allowed Memory Size Exhausted" in WordPress: Causes and Fixes for Memory Limit Errors
Fix WordPress memory limit errors: what "allowed memory size exhausted" means, how to raise WP_MEMORY_LIMIT and the PHP limit, and how to find the cause.

On this page
- What the error means
- Other memory errors you might see
- Common causes
- Check your current limits
- How to fix WordPress memory limit errors
- Where to change the memory limit on common Indian hosting
- When hosting is the real problem
- Stop it happening again
- Quick check: what memory limit does WordPress actually get?
- When to get help
- FAQs
- The "allowed memory size exhausted" error means one page request needed more PHP memory than allowed; the file named is a clue, not always the culprit.
- Setting WP_MEMORY_LIMIT to 256M and raising the PHP limit in your hosting panel fixes many cases, but only up to the cap your host allows.
- If normal pages need far more memory, find the heavy plugin, builder page or task on staging instead of raising the limit again and again.
WordPress memory limit errors happen when a page needs more PHP memory than your site is allowed. To fix them, get the site back online, set WP_MEMORY_LIMIT to 256M in wp-config.php, raise the PHP memory limit in your hosting panel if needed, and then find the plugin or task that is using so much memory.
The usual sign is "There has been a critical error on this website", with an error log line such as "Allowed memory size of 134217728 bytes exhausted". Raising the limit often gets the site back quickly, but it isn't always the real fix. Here's what memory errors mean, how to check your limits and how to deal with the cause.
What the error means
Each time a page loads, PHP (the language WordPress runs on) gives that request a fixed amount of memory. If WordPress, your theme and your plugins need more than that, PHP stops with a fatal error. Visitors see a critical error message or a blank white page, while the full message appears in your error log or in the email WordPress sends to the admin address.
A typical message looks like this: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /wp-content/plugins/some-plugin/file.php
- The first number is the limit in bytes: 134217728 is 128 MB and 268435456 is 256 MB
- "Tried to allocate" is only the last small request that tipped it over
- The file named is where memory ran out, not necessarily what used it up. Treat it as a clue, not a verdict
For the full process of getting a site with a critical error back online, see how to fix "There has been a critical error". If you see only a blank page with no message, the steps in the WordPress white screen of death guide also apply.
Other memory errors you might see
| What you see | What it usually means |
|---|---|
| "Allowed memory size ... exhausted" | The PHP memory limit for a single request was reached |
| "Out of memory (allocated ...)" | The server couldn't provide more memory at all, usually a hosting account or server limit rather than the PHP setting |
| Errors only on certain admin screens | A heavy task, such as a page builder editor, a large report or an import, needs more than normal pages |
| Image uploads failing with a message that the server can't process the image | Resizing a very large photo needed more memory than was available |
| 500 or 503 errors, or a "resource limit reached" page on shared hosting | The hosting account hit its overall limits, not just PHP's per-request limit |
In the Elementor editor, a low memory limit often shows up as a save that fails; see Elementor not saving changes for the other causes too.
Common causes
- A heavy or badly coded plugin that loads far more than it needs on every page
- A plugin conflict or loop: two plugins interacting badly can eat memory until the limit is hit, often straight after an update; see how to find and fix plugin conflicts
- Page builders on very long pages with many sections and widgets, especially in the editor
- Imports, exports and reports: WooCommerce product imports, large order exports and analytics screens
- Backup plugins compressing a large site from inside WordPress
- Very large images: phone photos uploaded at full size
- A low limit set by the host on some budget plans
- Malware: occasionally, injected code is behind sudden, unexplained memory use
Check your current limits
In the dashboard, go to Tools, then Site Health, then Info:
- Server, PHP memory limit: the limit set on your hosting
- WordPress Constants, WP_MEMORY_LIMIT: the memory WordPress asks for on normal pages
- WordPress Constants, WP_MAX_MEMORY_LIMIT: the memory WordPress asks for during heavier admin tasks
WordPress tries to raise PHP's limit to match these settings, but many hosts set a cap it can't go past. If changing the WordPress setting makes no difference, the limit has to be raised on the hosting side.
How to fix WordPress memory limit errors
1. Get the site back online
If visitors can't see the site, use the recovery mode link in the admin email, or deactivate the plugin named in the error by renaming its folder through your hosting file manager or SFTP. Take a backup before changing anything else.
2. Raise WordPress's memory setting
Add this line to wp-config.php, above the comment that begins "That's all, stop editing!":
define( 'WP_MEMORY_LIMIT', '256M' );
256M is a sensible setting for most business sites. If errors only happen in the dashboard, for example during imports or updates, WP_MAX_MEMORY_LIMIT controls admin tasks and can be set the same way. Ask your developer if you're not comfortable editing this file.
3. Raise the PHP limit at your host
Most control panels let you change PHP options, including memory_limit, in a section such as "Select PHP Version", "MultiPHP INI Editor" or PHP configuration. If you can't find it, ask your host's support team. Some guides suggest editing .htaccess or php.ini instead; that only works on certain server set-ups and can cause a 500 error, so prefer the control panel.
4. Find what's actually using the memory
If normal pages need far more than 256M, raising the limit further only hides a problem that will come back. Instead:
- Check the error log to see which plugin files keep appearing
- Use the free Query Monitor plugin on a staging copy to see peak memory use for each page
- Deactivate plugins one at a time on staging until usage drops; see staging sites explained
- Replace heavy or abandoned plugins, split very long builder pages and run big imports in smaller batches
- Resize photos before uploading them
If WordPress rejects a file before it even uploads, with a message that it exceeds the maximum upload size, that's a different PHP limit; see how to increase the WordPress upload size limit.
Where to change the memory limit on common Indian hosting
Most business sites in India sit on shared or cloud hosting with a control panel. The exact menu names change between plans and panel versions, so treat this as a guide to where to look, not a precise path.
| Panel type | Where to look | If the option is missing |
|---|---|---|
| cPanel | Select PHP Version, then Options, or MultiPHP INI Editor | Ask support; some plans lock the value |
| hPanel and similar custom panels | Advanced or PHP configuration, then PHP options | The plan may have a fixed cap; check its limits |
| Cloud or VPS with a server panel | PHP settings for the site or application | Your developer can change it in the server's PHP config |
| Managed WordPress hosting | Often set by the host and not editable | Ask support whether a higher limit is possible |
After any change, check Site Health again to confirm the new value is actually in effect.
When hosting is the real problem
On budget shared plans, the PHP limit may be low and the account's total memory is shared by every visitor and background task. Signs you've outgrown your plan include memory errors that return during busy periods such as festival sales, a sluggish dashboard, backups that fail partway and resource warnings in your hosting panel. Sometimes a better plan or host is the right fix; see how to choose WordPress hosting in India.
Stop it happening again
- Test plugin and theme updates on staging before applying them to the live site
- Keep your plugin list lean and remove anything you don't use
- Keep PHP on a current, supported version; see how to update your PHP version safely
- Review error logs as part of monthly maintenance, so warnings are caught before visitors see errors
A site that uses less memory per page is usually faster too, so this work often overlaps with WordPress speed optimisation.
Quick check: what memory limit does WordPress actually get?
- In the dashboard, open Tools > Site Health > Info and expand Server. Note the PHP memory limit.
- Expand WordPress Constants and note WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT.
- If the server value is lower than the WordPress constant, the server wins. Raise it in your hosting panel's PHP settings, not only in wp-config.php.
When to get help
Get help when the error returns after you raise the limit, which usually points to one plugin using far too much memory, or when the site shows a critical error and you cannot reach the dashboard. Through WordPress maintenance and support the cause is traced in the error log, not hidden by a higher limit. You can also hire a WordPress developer in India for a one-off fix, or send the details through the contact form.
Related fixes: the PCLZIP_ERR_BAD_FORMAT error and WordPress menu not showing.
FAQs
How do I fix WordPress memory limit errors?
Get the site back online, add WP_MEMORY_LIMIT set to 256M in wp-config.php, raise memory_limit in your hosting panel if WordPress can't, then find the plugin or task using the memory on a staging copy.
What is a good PHP memory limit for WordPress?
256M suits most business sites and many WooCommerce stores. Heavier stores and admin tasks such as imports may need more, but if normal pages need far more, look for the cause.
Why does increasing WP_MEMORY_LIMIT not work?
Your host's PHP limit is lower and WordPress can't go past it. Raise memory_limit in the hosting panel or ask support, then confirm the value in Site Health.
Can a plugin cause the allowed memory size exhausted error?
Yes, it is the most common cause, especially after an update or when two plugins conflict. The error log often points to the plugin, though the named file is only a clue.
Will raising the memory limit slow my site?
No, the limit is a ceiling, not an amount used on every page. But pages that genuinely need a lot of memory are usually slow, so finding the cause helps speed as well.
How do I increase the WordPress memory limit in wp-config.php?
Add a WP_MEMORY_LIMIT line above the line that says to stop editing, save the file and reload the site. If the error stays, your host's PHP memory_limit is lower and caps it, so raise that in the hosting panel or ask support.
Need help with your website?
I'm a freelance WordPress developer building fast, SEO-friendly websites since 2020. Tell me what you need and I'll reply with a plan and a fixed quote, usually within 24 hours.


