A WordPress memory exhausted error means PHP ran out of memory while processing a request. It often appears as:
Fatal error: Allowed memory size of 134217728 bytes exhausted
Start by noting what triggered the error. If it appeared during a plugin update, page edit, import, backup, or scheduled task, that context can help identify the underlying cause. Raising the memory limit may restore access, but repeated errors usually require investigating the plugin, theme, or process consuming the memory.
Increase the WordPress memory limit
Back up wp-config.php before editing it. A syntax error in this file can make the entire site unavailable.
Open wp-config.php in the root directory of the WordPress installation. Add this line above the comment that says That's all, stop editing!:
define( 'WP_MEMORY_LIMIT', '256M' );
Save the file and repeat the action that caused the error.
WordPress documents WP_MEMORY_LIMIT as a way to request more PHP memory. It also notes that some hosting providers do not allow WordPress to raise the server's configured limit.
If the error occurs only in WordPress administration, you can also set a higher limit for administrative tasks:
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );
Do not keep increasing these values without checking the cause. A failing import or inefficient plugin can consume any additional memory you provide.
To roll back, remove the lines you added or restore the backup of wp-config.php.
Check the server-level PHP limit
WP_MEMORY_LIMIT cannot override a lower limit enforced by PHP or your hosting account. If editing wp-config.php has no effect, check the PHP memory setting in your hosting control panel or ask your provider for the effective memory_limit value.
On servers where you manage PHP configuration, the relevant php.ini setting is:
memory_limit = 256M
The exact configuration file and restart procedure depend on how PHP runs on the server. Managed hosting customers should use the provider's PHP settings page instead of editing server files directly.
After changing a server-level setting, repeat only the action that previously failed. If the same message still reports the old allowed memory size, the change probably affected the wrong PHP configuration or was rejected by the host.
Isolate the plugin causing the error
If the problem started after installing, updating, or using a plugin, increasing memory should be treated as a temporary recovery step.
With WP-CLI available, list the active plugins:
wp plugin list --status=active
Look first at plugins involved in the failing request. Common examples include page builders, imports, backups, security scans, image processing, and large ecommerce operations.
Deactivate the most likely plugin from the Plugins screen and repeat the failing action. Test one plugin at a time so you can identify the change that matters.
If the dashboard is inaccessible, rename the suspected plugin's directory inside wp-content/plugins. WordPress will treat the plugin as unavailable. Restore the original directory name after testing.
Deactivating a plugin can interrupt forms, checkout, scheduled jobs, or other site features. Perform the test during a low-traffic period and restore the plugin promptly if it is not responsible.
Check the theme when plugins are not responsible
A theme can exhaust memory through custom queries, recursive functions, or code that processes large amounts of data.
Temporarily switch to a current default WordPress theme and retry the same request. Do this on a staging site when changing the live design would affect visitors.
If the error disappears, restore the original theme and review recent theme changes, custom snippets, and child-theme code. Raising the memory limit alone will not correct a loop or an unbounded query.
Escalate recurring memory errors
Contact your host or developer when:
- The server ignores the limit set in
wp-config.php. - The error returns after the limit is increased.
- Memory is exhausted during ordinary page requests.
- You cannot isolate the problem without disabling essential site features.
- The error began after custom PHP code was deployed.
Send them the exact error message, the action that triggers it, and the approximate time it occurred. The filename and line number in the message identify where PHP finally failed, but that location is not always the code responsible for consuming the memory.