WordPress 'Allowed Memory Size Exhausted': The WP_MEMORY_LIMIT vs PHP Limit Trap (2026)
Disclosure: some links on this page are affiliate links. We may earn a commission at no extra cost to you. How we test and rate hosts.
The error: "Fatal error: Allowed memory size of X bytes exhausted" — a script (almost always a plugin/theme) hit the memory ceiling. The trap most guides miss: there are TWO limits — WP_MEMORY_LIMIT (what WordPress requests) and the server's memory_limit (the hard cap). Setting WP_MEMORY_LIMIT higher than the server cap does nothing. Here's the fix that accounts for both.
Step 1: Check the Real Limit First (Don't Edit Blind)
Tools → Site Health → Info → Server shows PHP memory limit — that's the ceiling. Elementor users: Elementor → System Info shows both limits. WooCommerce: WooCommerce → Status → System Status. Knowing the real cap determines whether your fix works at all.
The Two-Limit Distinction (What Most Guides Get Wrong)
- memory_limit (server, php.ini) — the hard cap PHP enforces. Your host controls this; you can't exceed it from WordPress.
- WP_MEMORY_LIMIT (wp-config.php) — what WordPress requests. Default ~40M (64M multisite). Cannot exceed memory_limit.
So the logic is: if Site Health shows memory_limit = 128M and you set WP_MEMORY_LIMIT = 256M, WordPress still gets 128M. The wp-config.php edit alone only works when the server cap is already higher.
Step 2: Raise WP_MEMORY_LIMIT in wp-config.php
In wp-config.php, above /* That's all, stop editing */:
define( 'WP_MEMORY_LIMIT', '256M' );256M is healthy for most sites; heavy WooCommerce/Elementor setups may need 512M. If Site Health showed memory_limit ≥ 256M already, this alone fixes it.
Step 3: Raise the Server Cap (When wp-config.php Isn't Enough)
If Site Health showed a lower cap, raise it at the server level — whichever your host allows:
- php.ini —
memory_limit = 256M(if your host exposes php.ini edits) - .htaccess —
php_value memory_limit 256M(works on Apache when allowed) - Hosting panel — many hosts (SiteGround Site Tools, cPanel MultiPHP INI Editor) have a PHP settings UI
- Ask support — on managed hosts, a ticket is often fastest
Step 4: Find the Memory-Hungry Plugin
If the error persists even at high limits, a plugin/theme is leaking memory — not hitting a cap, consuming everything. Disable plugins one at a time, reload, watch for the error. Query Monitor plugin shows per-plugin memory usage. A plugin that needs 512M+ is usually broken, not demanding — replace it.
When It's a Hosting Problem, Not a Config Problem
If every limit is raised correctly and the error still appears under normal traffic, the server's actual RAM allocation is the ceiling — not a setting you can edit. Oversold shared hosting enforces tight memory caps because hundreds of sites share the box. At that point the fix is a host with real headroom: Bluehost's WP Cloud tiers run WordPress on isolated infrastructure where memory_limit is generous by default, not throttled by neighbors.
Memory Limits That Aren't a Ceiling
Bluehost managed WordPress on WP Cloud — isolated containers with sane PHP limits by default. Stop fighting memory caps on oversold shared hosting.
Get Bluehost Managed WP →Related: critical error fix, white screen of death, 500 internal server error.
What are you building?
Tell us about your project so we can match the perfect hosting plan.
Hosting Cost Calculator
See exactly how much you'll spend on hosting over time. Compare Bluehost vs popular alternatives and discover your potential savings.
Used to calculate transaction fees (Shopify charges 2% on sales)
Frequently Asked Questions
How do I fix 'Allowed memory size exhausted'?
Add define( 'WP_MEMORY_LIMIT', '256M' ); to wp-config.php — but that only works if the server's PHP memory_limit allows it. Check Site Health > Info > Server to see the real limit; if it's lower than 256M, edit php.ini/.htaccess or ask your host — WP_MEMORY_LIMIT can't override the server cap.
What's the difference between WP_MEMORY_LIMIT and memory_limit?
WP_MEMORY_LIMIT is WordPress's request — 'I want this much.' memory_limit in php.ini is the server's hard cap — 'you can have at most this.' WP_MEMORY_LIMIT cannot exceed memory_limit; setting WP_MEMORY_LIMIT to 512M on a 128M server does nothing. Most guides miss this.
Where do I check my current memory limit?
Tools > Site Health > Info > Server shows 'PHP memory limit' — that's the real ceiling. Elementor users: Elementor > System Info shows both. WooCommerce: WooCommerce > Status > System Status.
Why does increasing memory in wp-config.php not work?
Because the server's memory_limit is lower than what you set — the hard cap wins. Either edit php.ini/.htaccess (if your host allows it) or ask the host to raise the server limit.
Is 'Allowed memory size' dangerous?
No — it's a resource cap hit, not data loss. A script (usually a plugin/theme) needed more memory than PHP was allowed to use. Fix the limit or find the memory-hungry plugin.
When is it a hosting problem, not a config problem?
When you've raised every limit correctly and still hit the cap under normal load — cheap shared hosting's tight memory limits are the cause. At that point the fix is a host with real headroom, not more config edits.
Ready to launch?
Get Bluehost from $3.99/month with a free domain, free SSL, and 30-day money-back guarantee.
Related Articles
Error Establishing a Database Connection in WordPress: 7 Fixes That Work (2026)
Fix 'Error establishing a database connection' in WordPress: verify wp-config.php credentials, test MySQL, repair database, check server load. Ordered by probability.
How to Fix 'There Has Been a Critical Error' in WordPress (2026 Recovery Guide)
Fix WordPress 'critical error on this website': use the recovery-mode email link first, then FTP fallback. Ordered fixes for plugin, theme, memory, PHP issues.
WordPress 500 Internal Server Error: 6 Fixes Ordered by Probability (2026)
Fix WordPress 500 internal server error: .htaccess corruption first (most common), then plugins, memory limit, PHP version, core files. Step-by-step recovery.
WordPress Stuck in Maintenance Mode? The One-File Fix (2026)
Fix 'Briefly unavailable for scheduled maintenance': delete the .maintenance file via FTP or file manager. Plus how to finish the interrupted update properly.
How to Cancel DreamHost (and Actually Get the 97-Day Refund) — 2026
Cancel DreamHost hosting: the real refund window, domain clawback rules, what 'credit vs refund' means, and how to migrate before you cancel.
Bluehost vs Squarespace vs Wix 2026: The 3-Way Verdict
Bluehost vs Squarespace vs Wix compared: real costs over 3 years, ownership, SEO, ecommerce, and who each platform is actually for. Clear winner by use case.