How I Fix WordPress Memory Limit Exhausted Errors

Laptop on a desk showing a WordPress memory warning during site maintenance

When a page dies mid-load with “Allowed memory size exhausted,” or wp-admin flashes a critical error after a plugin update, I treat it as a wordpress memory limit problem before I rebuild the theme. PHP has a hard ceiling. When WordPress, a page builder, WooCommerce, or a heavy import crosses it, the process stops — sometimes with a white screen, sometimes with a recovery email.

I maintain WordPress sites from Surat for businesses and stores, so I see this after big product imports, Elementor edits on dense pages, or a host that still ships a low default limit. Below is how I confirm the wordpress memory limit is the real bottleneck, how I raise it safely, and how I stop chasing more megabytes when a plugin is the actual culprit.

What a wordpress memory limit error looks like

I do not raise memory on every mysterious failure. I look for a clear pattern first.

  • Fatal messages that mention “Allowed memory size of X bytes exhausted
  • A critical error on one heavy admin screen (product import, theme customizer, page builder) while the front end still loads
  • Blank or half-rendered pages after cloning a large site or restoring a big database
  • Debug log lines that name the same plugin or template right before the memory fatal
  • A host panel that still shows 64M or 128M PHP memory on a store or builder-heavy site

If the site is blank with no memory message at all, I start with the same calm isolation I use for the WordPress white screen of death. Memory fatals are one cause of a blank page — not the only one.

Why WordPress runs out of memory

WordPress itself is usually fine on a modest limit. The ceiling gets hit when one request loads too much at once: a page builder parsing a huge layout, WooCommerce building a large variable product, an importer holding a CSV in memory, or several plugins each attaching expensive admin scripts. Shared hosts often set a cautious default so one noisy site cannot starve the server.

Official WordPress documentation on editing wp-config.php covers the WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT constants. Raising those only helps when PHP’s own memory_limit is allowed to follow. If the host caps PHP at 128M, a higher WordPress constant will not magically unlock more.

Quick checks before I change the wordpress memory limit

I gather evidence before editing config files.

  1. Reproduce the exact URL or admin action that fails (homepage, one product edit, one import)
  2. Enable WP_DEBUG_LOG with display off and read the last fatal in wp-content/debug.log
  3. Note the current PHP memory_limit from Site Health, a phpinfo page, or the host panel
  4. Write down the last change: plugin update, import, PHP version bump, or theme switch
  5. Confirm a recent backup exists before any config edit

If the log names one plugin every time, I treat that plugin as the suspect the same binary-search mindset I use when I debug a WordPress plugin conflict — instead of jumping straight to 512M for everyone.

Developer checking PHP wordpress memory limit settings beside a debug log on a laptop

How I raise the wordpress memory limit safely

I change one layer at a time and retest the failing action after each step. I prefer staging when the host makes a clone easy.

1. Set WordPress constants in wp-config.php

Above the stop editing” line I add (or adjust):

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

Front-end requests use WP_MEMORY_LIMIT. Admin and some heavy tasks use WP_MAX_MEMORY_LIMIT. For many brochure sites, 256M is enough. Busy WooCommerce or builder sites sometimes need 256M–512M — I only go higher when the log still shows exhaustion after cleanup.

2. Align PHP’s memory_limit

If Site Health still reports a lower ceiling, I raise PHPs memory_limit in the host panel, a local php.ini, or (when the host allows it) an .user.ini / MultiPHP INI editor. WordPress constants cannot exceed what PHP will grant. After saving, I reload Site Health or phpinfo and confirm the new value before I declare the wordpress memory limit fixed.

3. Remove the real hog when memory is only a symptom

A higher limit hides a leak for a while. If one importer, backup plugin, or page-builder widget balloons on every save, I update or replace that tool, split the import into smaller batches, or simplify the layout. I also check for overlapping “optimization” plugins that load the same work twice less code in the request often beats another 128M.

4. Watch hosting and PHP version ceilings

Some shared plans hard-cap memory no matter what you put in wp-config. After a PHP upgrade, old plugins can also allocate poorly and hit the limit sooner. I fix or replace the outdated code first, then leave the new PHP version on — the same order I use during careful maintenance windows under WordPress maintenance and security.

wp-config snippet raising the wordpress memory limit for admin-heavy WordPress sites

How I test after changing the wordpress memory limit

  1. Retry the exact action that failed (import, builder save, product edit)
  2. Confirm the homepage, a key inner page, and wp-admin still load
  3. On stores, retest cart, checkout, and a sample order email path
  4. Purge page cache and any host cache so you are not reading a stale error page
  5. Turn public error display off and keep logging only while you still need it

If the site went through a move before memory errors started, I also confirm URLs and HTTPS are clean — leftover mixed assets and redirect fights waste time you could spend on the real ceiling, as in my notes on a WordPress redirect loop.

How I keep memory fatals from coming back

  • Keep a realistic wordpress memory limit for the stack you actually run — not a guess copied from a forum
  • Update builders, WooCommerce extensions, and backup plugins on staging first
  • Split huge imports and avoid running backup + import + page-builder save at the same moment
  • Remove unused plugins so admin screens load less code
  • Record the working PHP memory value in the maintenance log after each host change

For performance that is about page weight rather than PHP ceilings, I still start with caching and images — the order in why a WordPress site feels slow. Memory work is for fatals and critical errors, not for shaving a second off LCP.

When you need the constant reference again, WordPress documents WP_MEMORY_LIMIT in the same wp-config memory section I follow on client sites.

Quick wordpress memory limit checklist

  • Confirm the fatal mentions exhausted memory (or the log does)
  • Note the failing URL or admin action and the current PHP limit
  • Backup, then set WP_MEMORY_LIMIT / WP_MAX_MEMORY_LIMIT and align PHP
  • Retest the failing action; purge caches
  • If it still dies, isolate the heavy plugin or split the workload
  • Document the final limit and avoid stacking overlapping heavy tools

A wordpress memory limit error feels scary because it stops work mid-save, but it is usually a measurable ceiling plus one heavy request. If your site or store keeps hitting exhausted memory and you want a second pair of hands from Surat, email me at rnitinb@gmail.com or use the contact page — I am happy to read the log, set a sane limit, and trim whatever is burning through RAM on every request.

Leave a Comment

Your email address will not be published. Required fields are marked *

Drag To Verify