Errors 2 min read

How to Increase the WordPress Memory Limit

"Allowed memory size exhausted" errors stop pages, page builders and WooCommerce in their tracks. Here's how to raise the PHP memory limit in WordPress — and when the real fix is elsewhere.

On this page

Key takeaways

  • “Allowed memory size of X bytes exhausted” means a PHP process needed more memory than allowed.
  • Raise WP_MEMORY_LIMIT (front end) and WP_MAX_MEMORY_LIMIT (admin) in wp-config.php — but the server’s PHP limit is the ceiling.
  • If memory use keeps climbing, find the heavy plugin rather than raising limits forever.

Memory errors often appear during updates, imports, image processing, page-builder editing or WooCommerce tasks. Here’s how to raise the limit correctly and how to know when the real problem is elsewhere.

Check your current limits#

Go to Tools → Site Health → Info → Server (PHP memory limit) and WordPress constants (WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT).

Method 1: wp-config.php#

Add above /* That's all, stop editing! */:

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

WordPress can’t exceed the server’s memory_limit. If Site Health still shows a lower value, raise it on the server too.

Method 2: server PHP settings#

Where Setting
cPanel → MultiPHP INI Editor / Select PHP Version → Options memory_limit = 512M
.user.ini or php.ini in the site root memory_limit = 512M
.htaccess (Apache with mod_php only) php_value memory_limit 512M
Managed hosts Dashboard setting or ask support
Site type Front end Admin
Blog / brochure site 128–256M 256M
Page builders, many plugins 256M 512M
WooCommerce, LMS, memberships 256–512M 512M+

Need a hand with this?

Get a quick, honest review of your website’s SEO.

Chat on WhatsApp

When raising the limit isn’t the answer#

If a simple page needs 512 MB, something is wrong: a plugin loading huge datasets, an infinite loop, or a bloated autoloaded option. Use Query Monitor to see peak memory per page and identify the culprit. Check wp_options autoload size — see database optimization.

  • White screen — memory exhaustion is a common cause; see white screen of death.
  • Maximum execution time exceeded — raise max_execution_time (e.g. 120) for imports and backups.
  • Upload size limits — upload_max_filesize and post_max_size.

Memory limit FAQ#

Does a higher memory limit make WordPress faster?#

No. It only prevents crashes when a process needs more memory. Speed comes from caching, efficient code and good hosting.

Is 512M safe on shared hosting?#

Your host may cap it. If processes regularly need that much, consider better hosting or fixing the heavy plugin.

Why is admin memory higher?#

Admin tasks like updates, imports and image editing need more memory than displaying pages.

Found this useful? Share it

Join the discussion

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

Security code image. If you cannot read it, press refresh or contact me on WhatsApp.