The WordPress memory exhausted error appears when PHP needs more memory than the server allows. The message usually includes “Allowed memory size exhausted” followed by a file path and line number.
Increasing the limit may restore the website, but the permanent fix is identifying why WordPress consumed so much memory.
1. Confirm It Is a Memory Error
Check the visible error, PHP error log, or /wp-content/debug.log. A confirmed memory error looks similar to:
Fatal error: Allowed memory size of 134217728 bytes exhausted
The file path may identify the plugin, theme, or process running when memory was exhausted.
2. Create a Current Backup
Before editing configuration files, confirm that you have a recent backup containing both the WordPress files and database.
3. Increase the WordPress Memory Limit
Open wp-config.php and add this line above the line that says to stop editing:
define( 'WP_MEMORY_LIMIT', '256M' );
For memory-intensive administrator tasks, WordPress also supports:
define( 'WP_MAX_MEMORY_LIMIT', '256M' );
The official WordPress documentation notes that a hosting provider may prevent WordPress from increasing PHP memory beyond the server limit.
4. Check the Actual PHP Limit
Your host’s PHP configuration can override WordPress. Check the PHP memory limit in Site Health, the hosting dashboard, or a PHP information page. Contact the host if the limit does not change after editing wp-config.php.
5. Disable the Plugin Named in the Error
If the error path points to a plugin, deactivate it and test again. If wp-admin is unavailable, rename that plugin’s folder inside wp-content/plugins using a file manager, SFTP, or FTP.
Do not assume the last file shown is always the root cause. Review the complete log and recent changes.
6. Check the Active Theme and Custom Code
Theme functions, page builders, large database queries, and custom WPCode snippets can exhaust memory. Temporarily disable the most recent code change or switch to a default theme to confirm the source.
7. Look for Resource-Heavy Processes
Common memory-heavy tasks include:
- Large imports or exports
- Image regeneration
- Backups running inside WordPress
- Malware scans
- Page builders loading large pages
- Database queries returning excessive records
- Multiple security or caching plugins doing similar work
8. Check for Malware or Unexpected Activity
Sudden memory spikes can come from malicious scripts, automated bot activity, or compromised plugins. Review recent file changes, security logs, and server resource usage.
See how to determine whether bots are targeting your WordPress website.
Should You Keep Raising the Memory Limit?
No. More memory can provide temporary breathing room, but repeatedly increasing the limit can hide inefficient code or a damaged process. Once the website works, identify what consumed the memory and remove or repair it.
Can Memory Errors Affect SEO?
Yes. If important pages return fatal errors or 500 responses, search engines and visitors cannot access them. Repeated failures also hurt user experience and conversions.
Preventing Future WordPress Memory Errors
- Remove unnecessary plugins and themes.
- Run large imports and backups during low-traffic periods.
- Monitor PHP and server resource usage.
- Test updates on staging.
- Use ongoing WordPress website maintenance.
