WordPress “Allowed Memory Size Exhausted” Error: How to Fix It (2026)

Laptop with lines of code on a busy desk

“Allowed memory size exhausted” means PHP ran out of memory while WordPress was working. To fix it, add define( 'WP_MEMORY_LIMIT', '256M' ); to wp-config.php above the “stop editing” comment. If the error stays, your host is capping memory, so ask them to raise it, and find the plugin that uses too much.

Raising the limit makes the error go away, but it does not always fix the cause. This guide shows the quick fix first, then how to check whether the setting really changed and what to do when it did not.

What the Error Looks Like

You usually see a message like “Allowed memory size of 41943040 bytes exhausted (tried to allocate …)” on a white page, in the dashboard, or in the error log. It often appears during a plugin update, an import, a backup, or a heavy page. It can also show up as a blank screen or a 500 error, so see our guides on the white screen of death and the 500 internal server error if you cannot read a message.

Quick Diagnosis

Where it happens Likely cause Start with
Only in wp-admin, on update or import Admin tasks need more memory Fix 2
On the front end of a heavy page Plugin or page builder uses a lot Fix 1, then Fix 4
Changing the setting changes nothing Host caps memory Fix 3
Started right after one plugin update A plugin that over-uses memory Fix 4

Before You Start

Back up your site. You are editing wp-config.php, and a typo there can take the whole site down. Use your host’s file manager or FTP.

Fix 1: Set WP_MEMORY_LIMIT in wp-config.php

The WordPress handbook describes WP_MEMORY_LIMIT as the setting for the maximum memory PHP can use for WordPress. It says WordPress tries to raise PHP memory to 40MB on a single site and 64MB on multisite by default, so your value should be higher than that. Add this line above the comment that says to stop editing:

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

The handbook’s own examples use 64M and 96M. 256M is a common, generous choice, not an official recommendation, so start modest and raise it only if needed.

Fix 2: Raise the Admin-Only Limit

The handbook says admin tasks may need more memory than normal visits, and you can set a separate limit for the dashboard with WP_MAX_MEMORY_LIMIT:

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

This helps when the error only appears in wp-admin, for example during an update or image processing.

Fix 3: Ask Your Host or Edit php.ini

WP_MEMORY_LIMIT only works up to what the server allows. The handbook says you can also raise the limit in php.ini, and that php.ini is not a WordPress file, so if you are unsure, contact your host. On shared hosting you often cannot change it yourself. Tell support the exact error text and the limit you want, then ask them to raise the PHP memory limit for your account.

Fix 4: Find the Plugin or Theme Using Too Much

If you raised the limit and the error returned, something is using memory it should not. Deactivate all plugins, check the site, then reactivate one at a time. If you cannot log in, rename the plugins folder through FTP, as described in our 500 error guide. Switching to a default theme rules out the theme.

Once you know the plugin, check for an update, look for the same report on its support forum, or replace it with a lighter one.

Check That the New Limit Is Active

Go to Tools > Site Health > Info > Server and look at the PHP memory limit. If it still shows the old number, the server is overriding wp-config.php and you need Fix 3.

Verified Facts and Sources

The constants, the 40MB and 64MB defaults and the admin-only limit come from the WordPress handbook page on editing wp-config.php. The php.ini advice and “allowed memory size exhausted” guidance come from the handbook page on common errors. We did not test these steps on a live failing site for this article.

Frequently Asked Questions

What is the default WordPress memory limit?

According to the handbook, WordPress tries to raise PHP memory to 40MB for single sites and 64MB for multisite.

What is the difference between WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT?

The first sets memory for normal WordPress operation. The second sets the limit for admin tasks, which may need more.

I changed wp-config.php and nothing happened. Why?

Your host may cap PHP memory. Check Site Health, then ask your host or edit php.ini if you have access.

Is a higher memory limit always the fix?

No. It can hide a plugin that uses too much memory. If the error returns, find that plugin.

Updated December 1, 2026.

Similar Posts

Leave a Reply

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