Common causes
- WP_MEMORY_LIMIT left at the 40M default (64M on multisite) on a site with heavy plugins
- The host's PHP memory_limit is low and cannot be overridden by WordPress
- Page builders, WooCommerce and backup plugins needing more memory on admin screens
- Large image uploads processed by GD or Imagick to create thumbnails
- A plugin loading huge queries, such as all posts or orders at once
- Bloated autoloaded options in wp_options loaded on every request
How to fix it
- Raise WP_MEMORY_LIMIT. Add define('WP_MEMORY_LIMIT', '256M'); to wp-config.php above the line /* That's all, stop editing! */. WordPress raises PHP's memory_limit to this value for front-end requests if the server allows it.
- Raise WP_MAX_MEMORY_LIMIT for admin. Admin screens and image processing use WP_MAX_MEMORY_LIMIT, which defaults to 256M. Add define('WP_MAX_MEMORY_LIMIT', '512M'); only if admin tasks still fail.
- Raise PHP's memory_limit if WordPress cannot. Check Tools > Site Health > Info > Server for the PHP memory limit. If it does not change, set memory_limit = 256M in php.ini, .user.ini or the hosting panel, and restart PHP-FPM, because some hosts block runtime changes.
- Find the plugin using the memory. The path in the error often points to the plugin folder. Use Query Monitor to see peak memory per page, and disable plugins one at a time on staging to confirm.
- Shrink autoloaded options. Run wp option list --autoload=on --format=total_bytes, or the SQL query in the code box, to measure autoloaded data. Remove leftovers from deleted plugins and large expired transients with wp transient delete --expired.
- Reduce image sizes before upload. Very large photos need a lot of memory to resize. Resize them to a sensible width before uploading, or use a host with Imagick, which is usually more memory efficient than GD.
wp-config.php (plus an SQL size check)
define( 'WP_MEMORY_LIMIT', '256M' ); // front end
define( 'WP_MAX_MEMORY_LIMIT', '512M' ); // wp-admin, image processing
-- autoloaded options size (MySQL)
-- SELECT SUM(LENGTH(option_value)) FROM wp_options WHERE autoload IN ('yes','on','auto-on','auto'); How to stop it happening again
- Remove unused plugins and their leftover options
- Monitor memory per request with Query Monitor during development
- Resize images before uploading
- Ask your host for a memory_limit that matches your plugin stack