WordPress

How to Fix the WordPress Memory Exhausted Error

The “Allowed memory size of X bytes exhausted” error means a WordPress script tried to use more memory than your site is allowed. It often appears as a white page or a broken admin area. The fix is usually to raise the memory limit — here is how, plus how to avoid it coming back.

What causes it

Every PHP script has a memory limit. Heavy themes, lots of plugins, large imports or image processing can push past a low limit and trigger the error. Raising the limit gives WordPress the headroom it needs.

Fix 1: Increase memory in wp-config.php

Edit wp-config.php in your WordPress folder using the File Manager, and add this line just above the “That’s all, stop editing” comment:

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

This asks WordPress to use up to 256MB, which resolves most cases.

Fix 2: Raise the PHP memory limit

If the error persists, the server-level PHP limit may need raising too. Our guide on increasing the PHP memory limit in cPanel walks through it, and you can also adjust it via the PHP settings for your site.

Fix 3: Find the real culprit

If you constantly hit the limit, something is using excessive memory. Deactivate plugins one at a time to find a heavy one — see disabling a plugin — and consider a lighter theme. Keeping within your resource limits keeps the whole site healthier.

Frequently asked questions

How much memory should I set?

256M suits most sites; heavier WooCommerce stores may need more. Only raise it as much as you need — endlessly increasing it hides an underlying problem.

My change to wp-config.php did nothing.

The server PHP limit may be capping it lower. Raise that too, or contact support to lift it for your account.

Could a plugin be to blame?

Often, yes. A poorly coded or heavy plugin can devour memory — disable plugins one by one to identify it.

Was this article helpful?