Error rescue

WordPress Memory Exhausted Error: Fix in 2 Minutes

By Ali Yasin Jatoi 4 min readUpdated July 2, 2026
Reviewed by Ali Yasin Jatoi, Founder & Lead Engineer· Updated July 2, 2026

Quick answer

The WordPress "Allowed memory size exhausted" error means a PHP script tried to allocate more RAM than the server allows. Fix by adding define('WP_MEMORY_LIMIT', '256M'); to wp-config.php above the "stop editing" line. If that doesn't take effect, raise memory_limit in php.ini or .user.ini, or ask your host to bump the server-level PHP memory limit.

What the error means in plain English

PHP allocates a fixed maximum amount of RAM per request. When a plugin, theme, or WordPress core process tries to use more than that ceiling, PHP kills the request and writes "Allowed memory size of X bytes exhausted" to the log — and often to the screen.

The fix is to give PHP more headroom, and then find the plugin that's spending it.

Fix #1 — Raise the WordPress memory limit

Edit wp-config.php via SFTP or your host file manager. Above the line that says "That's all, stop editing!" add:

define('WP_MEMORY_LIMIT', '256M'); define('WP_MAX_MEMORY_LIMIT', '512M');

Save. Reload the page. Most sites are fine at 256M. WooCommerce, LMS, or membership sites sometimes need 512M for admin operations.

Prefer we just fix it?

Runaway CPU, slow admin, and mystery timeouts are what our speed optimization service kills — Query Monitor + New Relic diagnosis, plugin swap-outs, and a documented before/after report. Learn more about WordPress speed optimization or grab a slot below.

Fix #2 — When wp-config doesn't take effect

Some hosts cap PHP memory at the server level and ignore WP_MEMORY_LIMIT. If the error persists after step 1, try adding this to a .user.ini file (or php.ini) in your WordPress root:

memory_limit = 256M

Still stuck? On strict shared hosting you'll need to open a ticket asking the host to raise memory_limit for your account. Most reputable hosts will bump you to 256M without pushback.

Fix #3 — Find the plugin eating memory

Install Query Monitor (free) and log in. On any slow admin page, expand the Query Monitor bar at the bottom → "Queries by Component". You'll see which plugin is running the heaviest queries.

Elementor, WPBakery, Yoast Premium, WooCommerce reports, and old backup plugins are frequent memory hogs. Replacing or updating one plugin often drops memory use by 40-60%.

When to call for help

If your memory ceiling is already 512M and you're still hitting the wall, you have either a rogue plugin in an infinite loop, corrupted transients, or a bloated database. All fixable — but faster with someone who's seen 100 of these.

We include memory tuning on every care plan. Book a rescue and we'll usually get the site stable in under 30 minutes.

Common questions

How do I fix "Allowed memory size exhausted" in WordPress?+

Add define('WP_MEMORY_LIMIT', '256M'); to wp-config.php above the "That's all, stop editing" line. If the error persists, raise memory_limit in .user.ini or php.ini, or ask your host to bump the server-level PHP memory limit for your account.

What's a safe PHP memory limit for WordPress?+

256M is comfortable for most sites in 2026. WooCommerce, LearnDash, and BuddyBoss/BuddyPress sites often need 512M for admin operations. Going above 512M usually means a plugin or theme is misbehaving — fix the leak instead of raising the ceiling.

Can too little PHP memory cause a white screen?+

Yes. When PHP runs out of memory mid-render, WordPress can't finish the page and returns a blank response. Enable WP_DEBUG_LOG and check /wp-content/debug.log — a memory exhausted line will be right there.

Does raising WP_MEMORY_LIMIT slow down the site?+

No. It only sets a ceiling — PHP uses what a script needs, not the full limit. The real performance question is what's using the memory. Query Monitor tells you exactly which plugin.

Want help with this?

The pages below go deeper, by service and by city.

Want this handled for you?

Book a call and we will review your site before recommending anything.

Call Book a call