WordPress Memory Exhausted Error

WordPress Memory Exhausted Error error guide banner

DIRECT ANSWER

The WordPress “Allowed memory size of X bytes exhausted” error means a PHP request used more memory than its configured `memory_limit` allows, so PHP stopped it. Requesting more memory may restore the failed task, but recurring errors usually point to a memory-heavy plugin, theme, import, or bulk operation. Repeat the exact action that failed after each change so you can confirm the real fix.

Key takeaways

  • This is a PHP memory-limit failure; it does not necessarily mean WordPress is corrupted.
  • Add define('WP_MEMORY_LIMIT', '256M'); to wp-config.php, above the “That’s all, stop editing!” line, as an initial WordPress-level adjustment.
  • The server’s PHP memory_limit can override or restrict the value requested by WordPress.
  • Failures limited to imports, bulk edits, migrations, or one plugin screen usually indicate a workload or component-specific memory problem.
  • If the error continues at 256M or 512M, reduce batch sizes and isolate the responsible plugin or theme instead of continually raising the limit.
Reviewed 2026-09-25 WordPress Errors
SA

Site Administrator

Last reviewed: September 25, 2026

What this error means & how to recognize it

  • A fatal error includes wording similar to Allowed memory size of 134217728 bytes exhausted (tried to allocate ... bytes).
  • The entire site may fail, or the problem may be limited to the dashboard, one plugin screen, an import, a migration, or a bulk action.
  • The error can begin after installing or updating a plugin or theme, starting a large data operation, or moving the site to hosting with a lower PHP memory limit.
  • The homepage may load normally while an import, page-builder screen, product synchronisation, or other memory-intensive task fails.
  • Increasing memory may appear to fix ordinary pages while the original operation continues to fail.

Root causes, ordered by likelihood

  1. The PHP memory_limit is too low for the site or request. WordPress core, the active theme, plugins, the current request, and the data being processed can exceed a conservative hosting default.
  2. A plugin or theme has high memory usage. Page builders, import/export tools, backup software, caching tools, and broad SEO or marketing suites may use substantially more memory during particular tasks.
  3. A large operation is processing too much data at once. Media imports, product synchronisation, migrations, and search-and-replace tasks can exceed the limit even when normal page loads work.
  4. The active plugin set has high combined baseline usage. Several moderate consumers can exceed the limit together.
  5. Configuration layers do not agree. wp-config.php, the hosting panel, php.ini, .user.ini, and applicable .htaccess settings may produce different effective values for web requests.
  6. A component has an inefficient processing path or memory leak. This becomes more likely when a specific action fails with a modest workload or after repeated use, rather than only during a predictably large operation.

How to fix it

1Does every request fail? Check the effective web PHPmemory_limit and WordPress configuration first.2Does only one screen or task fail? Identify the relatedplugin, theme feature, import, bulk action, ormigration; reduce its workload.3Did the issue begin after a change? Test the newlyinstalled or updated plugin, theme, or hostingconfiguration first.4Did WP_MEMORY_LIMIT help? Retry the exact failed action.If it did not help, check the server-level cap and thePHP configuration used by web requests.5Does it remain at 256M or 512M? Isolate plugins andthemes, reduce batch size, and contact the host if theplan enforces a ceiling.
Diagnostic flow at a glance — full detail in the steps below.

1. Identify the failing request

Copy the complete fatal-error message if available. Record whether the failure affects every page, only the dashboard, one plugin screen, or a particular operation such as an import or bulk edit. This distinction helps separate a generally low limit from a workload-specific problem.

2. Request more memory from WordPress

Before editing files, make a backup or confirm that you can restore the current configuration. Using SFTP or your host’s file manager, open wp-config.php and add this line above /* That's all, stop editing! */:

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

This asks WordPress to use 256 MB where the server permits it. If the constant already exists, edit that definition instead of adding a second one. Some administrative tasks can use a separate admin memory setting, so a dashboard-only failure may need additional investigation.

3. Check the PHP limit used by the website

WP_MEMORY_LIMIT cannot raise PHP above the server’s own memory_limit. Check the hosting control panel or the php.ini used by the PHP version serving the site. On a VPS, changing the relevant PHP configuration may require restarting PHP-FPM or the applicable PHP service; do this only with the necessary access and authorization.

Some Apache configurations using mod_php permit a setting such as:

apache
php_value memory_limit 256M

in .htaccess. This does not apply to PHP-FPM and may cause a server configuration error where the directive is not permitted. Use the hosting panel or ask the host before adding it. A command-line PHP setting may differ from the configuration used by web requests.

4. Repeat the exact failing action

Retry the import, bulk edit, plugin operation, or page request that produced the error. Loading the homepage alone is not sufficient because an ordinary page may use much less memory than the failed task. If the task succeeds, monitor it and avoid raising the limit further unless the same operation still needs more memory.

5. Reduce the operation’s peak memory use

For imports, migrations, synchronisations, or bulk edits, lower the tool’s batch size or split the work into smaller groups. This is often safer than assigning a very high limit to every PHP request. Running large jobs during a quieter period may reduce operational risk, but it does not lower the request’s peak memory requirement.

6. Isolate the likely plugin or theme

If 256M or 512M is still insufficient, or the issue began after a change, test the component associated with the failing screen or task. Use a staging copy when possible. On a live site, make a backup first and deactivate plugins one at a time. If the dashboard is inaccessible, use SFTP or the file manager to temporarily rename the suspected plugin directory so WordPress cannot load it.

Prioritise the recently changed component and the plugin linked to the failure, followed by page builders, import/export tools, backup tools, caching tools, and large all-in-one suites. If front-end pages fail, test with a default theme as well. Restore unaffected components after each test so you know which configuration was tested.

7. Compare effective configuration values

If changing WP_MEMORY_LIMIT has no visible effect, compare the WordPress request with the PHP value used by web requests. Review the hosting panel, php.ini, .user.ini, and applicable .htaccess settings, along with any host-imposed ceiling. Ask the host which PHP configuration applies if you cannot verify it yourself.

8. Confirm the lasting fix

Run the original failing operation again, then check important front-end and administrative pages. If the site works only after a very large limit is set, treat that as a diagnostic clue and continue investigating the responsible plugin, theme, query, or batch size rather than considering the issue permanently resolved.

Prevention & how to verify the fix

  • Use a deliberate, host-supported WordPress memory value rather than waiting for a production task to fail.
  • Remove unused plugins and periodically review the active plugin set because baseline memory use is cumulative.
  • Keep import, migration, synchronisation, and bulk-edit batches within the available PHP memory.
  • Test large operations on staging or with a limited data set before processing the full site.
  • After plugin or configuration changes, repeat the operation that previously failed and verify both front-end and admin pages.
  • Record which PHP configuration applies to web requests so future memory changes are made in the correct place.

When to get outside help

Contact your hosting provider when you cannot identify the PHP configuration used by web requests, when a requested memory value is ignored, or when .htaccess and PHP-FPM settings are unclear. Ask whether the hosting plan enforces a hard memory ceiling and whether it can be raised.

Consult a WordPress developer when one plugin or theme consistently fails with modest workloads, the error continues at a host-supported 256M or 512M, or disabling the component is not practical because it controls critical functionality. If the host’s fixed limit is too low for normal site operations, an upgrade or different hosting plan may be necessary.

Run a website check

Frequently asked questions

What does “Allowed memory size exhausted” mean in WordPress?

It means a PHP process reached its configured memory_limit and attempted to allocate more memory. PHP stopped the request, producing a fatal error on a page or during a background or administrative operation.

Where should I add WP_MEMORY_LIMIT?

Add define('WP_MEMORY_LIMIT', '256M'); to wp-config.php, above /* That's all, stop editing! */. If the constant already exists, change the existing definition rather than adding a duplicate.

Why did changing WP_MEMORY_LIMIT not fix the error?

WordPress cannot request more memory than the PHP server allows. Check the memory_limit in the hosting panel or the configuration used by web requests. A command-line PHP setting may not apply to the website, and an Apache php_value setting does not apply to PHP-FPM in the same way.

Why does only an import or bulk edit trigger the error?

These tasks can process much more data in one request than a normal page view. Reduce the batch size or split the work into smaller groups, then raise the supported PHP memory limit if necessary.

Should I keep increasing the memory limit?

Not indefinitely. A moderate increase may be appropriate, but repeated failures at 256M or 512M indicate that you should isolate a memory-heavy plugin or theme, reduce the workload, or discuss server limits with the host.

Can a plugin cause this error even when the rest of the site works?

Yes. A plugin may use far more memory on its settings page or during an import, backup, synchronisation, or other intensive task than during ordinary page loads. Test the component associated with the failing action first.

Further documentation

For authoritative reference, consult the WordPress documentation for the WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT constants, the PHP documentation for memory_limit, and your hosting provider’s documentation for the PHP configuration used by web requests. For environment-specific directives, use the documentation for your server setup, such as Apache with mod_php or PHP-FPM.