Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared Managed Cloud India
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Best lists Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Troubleshooting · Troubleshooting

How to Fix "Allowed Memory Size Exhausted" in WordPress

Short answer

Raise the memory WordPress asks PHP for by adding define( 'WP_MEMORY_LIMIT', '256M' ); to wp-config.php, above the line that says stop editing. Then open Tools, Site Health and Info to check that the new limit is active. If the value does not change, your host caps PHP memory, so ask the host to raise memory_limit.

Key takeaways

  • The error means one PHP request tried to use more memory than PHP allowed, so PHP stopped it.
  • WordPress asks for 40M on a single site and 64M on multisite by default, as of November 2026.
  • WP_MAX_MEMORY_LIMIT covers admin work and defaults to 256M, as of November 2026.
  • PHP memory_limit is the server ceiling, and WordPress cannot go above it with wp-config.php alone.
  • If the error returns at 512M, find the plugin, theme or task that uses the memory.
  • Back up the site before you edit wp-config.php, and keep a copy of the old file.

What does “Allowed memory size exhausted” mean?

It means a single PHP request tried to use more memory than PHP allowed, so PHP stopped it with a fatal error.

The full message names the limit in bytes, such as 268435456 bytes. Divide that number by 1,048,576 to get megabytes, so 268435456 bytes equals 256M. The PHP manual says memory_limit sets the maximum amount of memory in bytes that a script is allowed to allocate.

WordPress runs inside PHP, so every page view, admin action, import and image task shares one memory pool for that request. When the total demand passes the limit, the page stops and visitors may see a blank page or a critical error message.

The WordPress Learn lesson on plugin and theme conflicts lists an exhausted memory limit among the common causes of a blank white screen. That link is useful because the same error can look different on the front end and in wp-admin. See the Learn WordPress lesson for that list.

What causes the error most often?

A limit that is too low for the site is the most likely cause, and a heavy task or faulty plugin is the next most likely cause.

WordPress asks for only 40M on a single site and 64M on multisite by default, as of November 2026. That default comes from the Editing wp-config.php guide. Many modern themes and plugins need more than 40M for one request.

Common triggers, most likely first, are:

  • A limit set at 40M or 64M on a site with a page builder or shop.
  • A large image upload, import or bulk update that spikes memory.
  • A plugin or theme that loads too much data at once.
  • A server PHP memory_limit lower than the value WordPress asks for.

Memory for one PHP request is not the same as total server RAM. For the difference, read how much RAM WordPress needs.

SettingDefault as of November 2026Where it appliesFirst value to try
WP_MEMORY_LIMIT40M single site, 64M multisiteFront end and most requests256M
WP_MAX_MEMORY_LIMIT256MAdmin screens and media work512M
PHP memory_limit128MServer ceiling for each script256M

How do you check your current memory limit?

Open Tools, then Site Health, then the Info tab, and read the Server section for the PHP memory limit.

The Site Health screen is built into WordPress core, and its Info tab gives a technical snapshot of the site. The Learn WordPress lesson describes the Status and Info tabs and the copy-to-clipboard export for support requests.

Note the number in your error message first, then compare it with the limit shown in Site Health. If the error says 134217728 bytes, the limit was 128M. If it says 268435456 bytes, the limit was 256M.

Also check the WordPress Constants section in the same Info tab for WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT. If the PHP limit is lower than the WordPress value, the PHP limit wins for that request.

WordPress.org recommends PHP 8.3 or greater, MariaDB 10.11 or greater or MySQL 8.0 or greater, and HTTPS support, as of November 2026. Check those versions in Site Health too, using the WordPress requirements page as your reference.

How do you raise the limit in wp-config.php?

Add one line to wp-config.php, above the line that says “That's all, stop editing!”, to ask PHP for 256M.

Back up the site before you edit the file. The Editing wp-config.php guide says to practise regular backups and know how to restore them before you change these settings, so use how to back up WordPress first.

Follow these steps in order:

  1. Open wp-config.php in the site root with your host file manager or SFTP.
  2. Find the line that says /* That's all, stop editing! Happy publishing. */.
  3. Add this line directly above it: define( 'WP_MEMORY_LIMIT', '256M' );
  4. Save the file and reload the page that failed.
  5. Open Tools, Site Health and Info to check that the new limit shows.

The PHP Optimization handbook gives 128M as an example value for WP_MEMORY_LIMIT, and 256M as the example for WP_MAX_MEMORY_LIMIT. Start at 256M for the front end, because it is above the 40M and 64M defaults and matches the admin default.

If the failure happens only in wp-admin, during uploads or imports, add a second line below the first: define( 'WP_MAX_MEMORY_LIMIT', '512M' );. The handbook says the backend usually needs more memory, mainly for media uploads.

What if wp-config.php does not change the limit?

If Site Health still shows the old value, the server PHP limit is lower than your new WordPress value, so WordPress cannot raise it.

The PHP Optimization handbook states that WordPress will raise the PHP memory_limit to these values if it has permission to do so, but it will not lower the amount if php.ini specifies a higher amount. The same page says shared hosting limits are often set at server level.

Try the PHP setting next, in this order:

  1. Look in your hosting panel for a PHP settings or PHP variables page.
  2. Set memory_limit to 256M there, if your host lets you change it.
  3. If you can edit php.ini or .user.ini, add or change this line: memory_limit = 256M.
  4. Save, wait a few minutes if your host caches PHP settings, then check Site Health again.

The Hosting.com guide says a PHP script can allocate up to 128M by default, and shows memory_limit = 256M as the change to allow 256M. It also says to use phpinfo() to verify the current value.

SiteGround gives a clear host example: its guide says the WordPress memory limit value is 256 MB by default on its servers, while the server PHP memory_limit is 768 MB for shared plans.

That shows why the WordPress value and the server value can differ on the same site. See the SiteGround guide for its 512M recommendation on its plans.

How do you find the plugin or theme that uses too much memory?

Read the file path in the error message first, because it often names the plugin or theme file that tried to allocate the memory.

The error line usually ends with a path such as wp-content/plugins/example-plugin/file.php and a line number. That file is the place where the allocation failed, even if the real cause is a larger task that called it.

If the path points to a plugin, deactivate that plugin and repeat the action that failed. If the error stops, that plugin is the trigger, and you should check for an update, a lighter setting or a replacement.

Use Troubleshooting Mode to test without changing the live site for visitors. The Learn WordPress lesson says Troubleshooting Mode deactivates all plugins and switches to a default theme for your browser session only, while other visitors see the site as normal.

To use it, install the Health Check and Troubleshooting plugin, then go to Tools, Site Health and the Troubleshooting tab. Enable the mode, reactivate plugins one at a time, and repeat the failing action after each one.

If the error still happens with a default theme and no plugins active, the cause is more likely the limit itself, a large import or a server ceiling. That result is useful, because it tells you not to keep removing plugins at random.

How do you fix it when it happens during uploads or imports?

Raise WP_MAX_MEMORY_LIMIT first, because admin work such as uploads and imports runs under that higher limit.

The PHP Optimization handbook says WP_MAX_MEMORY_LIMIT declares the amount WordPress should request for the backend, and its default is 256M. It also says the backend usually needs more memory, mainly for media uploads.

For a large image, reduce the file size before you upload it, and upload one file at a time instead of a large batch. For a large import, split the file into smaller parts and import one part at a time.

Check the PHP upload limits too, because a file that is too large can fail for a different reason. The handbook says post_max_size must be greater than or equal to upload_max_filesize, and PHP will not process requests larger than post_max_size.

If an import still fails at 512M, do not keep raising the limit. Split the import, remove the faulty rows or plugin, or ask your host whether the plan allows a higher PHP limit for that task.

How do you know the fix worked?

Repeat the exact action that failed, and check that it now completes without the fatal error.

Open Tools, Site Health and Info again, and confirm that the PHP memory limit shows the new value. The number in Site Health is the limit that applies to the request, so it is the check that matters.

Test the front end as a logged-out visitor, then test the admin action that failed, such as the upload or import. If both work, the fix holds for those two paths.

Watch the site for a day after the change, and note whether the error returns on a different page or task. A single success does not prove that a plugin leak is gone, so repeat the test after the next plugin update.

If the error returns at the same new limit, the limit was not the cause. Go back to the plugin and theme checks, and read the error log for the file path that appears each time.

When should you contact your host?

Contact your host when the limit in Site Health does not move after you change wp-config.php and the PHP setting.

The Editing wp-config.php guide says some hosts do not allow for increasing the PHP memory limit automatically, and in that event you should contact your host to increase the PHP memory limit.

Contact the host also when the error keeps happening at 512M, or when you cannot edit php.ini or the hosting panel.

Ask for the current PHP memory_limit, the highest value your plan allows, and whether a plan change is needed.

Send the host the error message, the file path in it, and a copy of your Site Health info. The Learn WordPress lesson says the copy-to-clipboard export in Site Health is the information a developer or host needs when you ask for help.

Before you contact the host, check the PHP version shown in Site Health. Read how to update PHP in WordPress before you ask for a version change.

What mistakes should you avoid?

Do not set the limit to -1, because that removes the PHP limit and lets a faulty script use all server memory.

The PHP manual says to set memory_limit to -1 to have no memory limit. That is a diagnostic setting, not a fix for a live site, and it can turn a small plugin fault into a server outage.

Avoid these mistakes:

  • Adding the define line after wp-settings.php is loaded.
  • Setting a value equal to or lower than the limit in your error.
  • Raising the limit again without finding the plugin or task that uses the memory.
  • Editing wp-config.php without a backup.
  • Treating a memory error as a speed problem.

The Editing wp-config.php guide warns that adjusting the WordPress memory limit can hide the root of the issue, and that you should debug the install if out-of-memory issues continue with a higher limit.

A memory error can also appear as a 500 error on some hosts, so do not assume a different fix is needed until you have read the message. For that error, read how to fix the 500 internal server error.

Frequently asked questions

How much memory should WordPress have?

Start with 256M for WP_MEMORY_LIMIT and 512M for WP_MAX_MEMORY_LIMIT if admin work fails. WordPress asks for 40M on a single site and 64M on multisite by default, while the admin default is 256M. Your host PHP limit is the ceiling, so check Site Health to see the value that actually applies.

Is 256M enough for WooCommerce or a page builder?

256M is a sound starting point for most sites, and many heavy sites need 512M for admin work such as imports and image processing. If the error returns at 512M, the cause is usually a plugin, theme or oversized task, not the limit alone. Split large imports and check the file path in the error.

Can I set WP_MEMORY_LIMIT to 1024M?

You can write a higher value, but WordPress cannot use more than the server PHP memory_limit allows. A very high value can also hide a plugin fault and let it use far more memory than it should. Raise the limit in steps, test the failing action, and stop raising it once the action works.

Why does the error happen only in wp-admin?

Admin screens run heavier tasks such as plugin updates, imports and image processing, so they need more memory than a normal page view. WordPress gives admin work a separate limit, WP_MAX_MEMORY_LIMIT, which defaults to 256M. Raise that value if front-end pages load but admin actions fail.

Does the error mean my site was hacked?

No, on its own it does not mean the site was hacked. It means one PHP request ran out of allowed memory. A faulty plugin, a large upload or a low limit are far more likely causes. If the error started right after a plugin change, deactivate that plugin first and check the error log.

Should I set memory_limit to -1 to stop the error?

No, do not set it to -1 on a live site. That removes the PHP limit, so a faulty script can use all available server memory and take the site down. Use a fixed value such as 256M or 512M, find the task that uses the memory, and ask your host if the plan ceiling is too low.

Sources

  1. Editing wp-config.php WordPress Developer Resources
  2. PHP Optimization WordPress Developer Resources
  3. Description of core php.ini directives PHP Manual
  4. Requirements WordPress.org
  5. How to Fix Fatal Error: Allowed Memory Size of Bytes Exhausted in WordPress SiteGround
  6. Changing the PHP memory limit for scripts Hosting.com

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

WPLegible editors

Researched from the primary sources listed above and checked against our editorial rules. About the site · How we test