Troubleshooting

WordPress Memory Exhausted Error — How to Fix It

"Allowed memory size exhausted" — a quick fix, and what's actually behind it.

Quick Answer: A memory exhausted error means a PHP process tried to use more memory than the server allows. Add define( 'WP_MEMORY_LIMIT', '256M' ); to wp-config.php to raise WordPress's own limit. If the error persists, the server's overall PHP memory_limit may also need raising by your host, since WordPress can't exceed what the server itself permits. Then identify what's actually consuming that much memory — usually a specific plugin — so the same error doesn't return at the higher ceiling.

Site Showing a Memory Error Right Now?

Tell us what's happening and we'll help you get it back up — or take it off your plate entirely going forward.

What "Memory Exhausted" Actually Means

PHP, the language WordPress runs on, is given a memory ceiling for each process as a safety limit — protecting the server from any single script consuming unlimited resources. When a page load, an import, an image edit, or a plugin operation tries to use more memory than that ceiling allows, PHP stops the process and returns this error instead of letting it run unchecked. It's a protective mechanism working as designed, not a random failure — which means the fix has two parts: raise the ceiling, and figure out why something needed that much in the first place.

Step 1: Raise WordPress's Own Memory Limit

Via FTP or your host's file manager, open wp-config.php and add this line just above /* That's all, stop editing! Happy publishing. */:

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

This raises the limit WordPress itself requests. For admin-side operations specifically (like bulk imports or plugin installs), you can also add: define( 'WP_MAX_MEMORY_LIMIT', '512M' ); which sets a separate, higher ceiling just for wp-admin.

Step 2: Check the Server's Actual PHP Memory Limit

WordPress's WP_MEMORY_LIMIT can't exceed what the server's own PHP configuration allows — if your hosting account's server-level memory_limit is capped at 128M, setting WP_MEMORY_LIMIT to 256M in wp-config.php won't actually raise it past that server ceiling. Check your hosting control panel's PHP settings section, or contact your host, to confirm and raise the server-level limit if it's the actual bottleneck.

Step 3: Identify What's Actually Consuming the Memory

Raising the limit resolves the immediate error, but if it keeps recurring at the new, higher ceiling, something is using an unusual amount of memory and is worth identifying rather than continuing to raise the limit indefinitely. Common culprits include plugins that process large images, generate PDFs on the fly, run scheduled backups, or sync data with an external service. Deactivating plugins one at a time while monitoring whether the error returns — or checking your host's resource usage graphs for spikes tied to specific actions — will usually identify the source.

Step 4: Consider Whether the Hosting Plan Is Undersized

Shared hosting plans frequently cap PHP memory at 128MB or lower, which is genuinely tight for a modern WordPress site running a typical set of plugins — a page builder, an SEO plugin, a caching plugin, and a security plugin can add up quickly even without anything unusual happening. If the site is legitimately using more memory than a shared plan supports simply through normal operation, the durable fix is a hosting environment with proper resource allocation, not a series of increasingly high limit overrides.

Related Troubleshooting Guides

Martin Van Den Boogerd
Martin Van Den Boogerd
Founder & Owner, CriticalWP — background in cybersecurity and municipal government infrastructure
More about Martin →

Common Questions

It means a PHP process tried to use more memory than the server's configured limit allows, and PHP stopped it to protect the server. It's commonly triggered by a resource-heavy plugin, a large import or export, an image-processing task, or simply too many active plugins running on a hosting plan with a low memory ceiling.
Add define( 'WP_MEMORY_LIMIT', '256M' ); to wp-config.php above the line that says "That's all, stop editing." If the error persists, the server's overall PHP memory_limit (set in php.ini or by your host) may also need raising, since WP_MEMORY_LIMIT can't exceed what the server itself allows.
It resolves the immediate error, but it's worth treating as a signal, not just a setting to bump. If the same error keeps recurring after raising the limit, something is consuming an unusual amount of memory — usually a specific plugin — and identifying it prevents the problem from resurfacing at a higher ceiling.
Deactivate plugins one at a time (or use a plugin performance profiler if available) while monitoring memory usage, or check your hosting control panel's resource usage graphs for spikes correlated with specific admin actions. Plugins that process images, generate PDFs, run backups, or sync large amounts of data are the most common culprits.
Yes. Shared hosting plans often cap PHP memory at 128MB or lower to control resource usage across many accounts on the same server, which is well below what a modern WordPress site with several active plugins commonly needs. If raising WP_MEMORY_LIMIT doesn't help, the hosting plan's own server-level limit may be the actual ceiling.

Your hosting shouldn't be the bottleneck.

Managed WordPress hosting means resource limits are sized for what your site actually needs — not a shared-hosting ceiling you keep bumping into.