Learn how to safely diagnose and fix the “Allowed memory size exhausted” error in WordPress using wp-config.php, plugins, and hosting tools without breaking your site.
Overview: What Is a WordPress Memory Exhausted Error?
The WordPress “Allowed memory size exhausted” error appears when PHP runs out of memory while trying to load your site. It often shows as a white screen with a message similar to:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate ...)
This guide walks you through safe, step-by-step methods to increase memory, identify heavy plugins or themes, and know when to contact your host.
Before You Start: Safety Checklist
- Have hosting access (cPanel, Plesk, or file manager) or FTP/SFTP.
- Back up your site (files + database) via your host or a backup plugin.
- Know your current PHP version (Dashboard ? Tools ? Site Health ? Info ? Server).
What You Should See
Once fixed, your pages should load normally without the fatal error message, and you should be able to access both the front end and the WordPress dashboard.
Step 1: Confirm You’re Seeing a Memory Exhausted Error
Sometimes this error is visible in the browser; other times it’s only in logs.
1.1 Check the Browser Error Message
Visit the page that fails to load. Look for text like:
Allowed memory size of 134217728 bytes exhaustedFatal error: Out of memory
1.2 Check Error Logs (If the Screen Is Blank)
- Log in to your hosting control panel.
- Open Logs or Error Logs (names vary by host).
- Look for recent entries mentioning
Allowed memory sizeorOut of memory.
What You Should See
You should be able to confirm that the error message explicitly references memory, not a missing file or database connection.
Step 2: Increase WordPress Memory Limit in wp-config.php
WordPress has its own memory limit, which may be lower than what your server allows. Increasing it often resolves the issue.
2.1 Access wp-config.php
- Connect via File Manager in your hosting panel or via FTP/SFTP.
- Navigate to your WordPress root folder (usually
public_htmlor a site-specific directory). - Locate the file named
wp-config.php. - Download a copy as a backup before editing.
2.2 Add or Adjust WP_MEMORY_LIMIT
- Open
wp-config.phpin a plain-text editor. - Find the line that says:
/* That's all, stop editing! Happy publishing. */ - Just above that line, add (or update) this line:
define( 'WP_MEMORY_LIMIT', '256M' );
- Save the file and upload it back to the server, replacing the existing file.
- Clear any caching plugin and your browser cache.
- Reload the page that was failing.
What You Should See
If the memory limit was the only issue, the error should disappear and the page should load normally. If the error persists, continue to the next steps.
Step 3: Check Server-Level PHP Memory Limit
Sometimes WordPress requests more memory than the server allows. In that case, you must raise the PHP memory_limit at the server level.
3.1 Check Current PHP Memory Limit
- In WordPress, go to Dashboard ? Tools ? Site Health ? Info.
- Expand the Server section.
- Look for PHP memory limit.
If it’s lower than 256M, you may need to increase it.
3.2 Increase PHP Memory Limit via Hosting Panel (If Available)
Exact names vary, but the process is similar:
- Log in to your hosting control panel.
- Open PHP Settings, MultiPHP INI Editor, or PHP Options.
- Find memory_limit.
- Increase it to 256M or 512M (if allowed by your host).
- Save or apply changes.
- Wait a minute, then refresh your site.
3.3 If You Can’t Change It Yourself
If your hosting panel doesn’t expose PHP settings, open a support ticket with your host and request:
Please increase the PHP memory_limit for my site to at least 256M (512M if possible). I’m receiving “Allowed memory size exhausted” errors in WordPress.
What You Should See
After the change, the Site Health ? Info ? Server section should show the new memory limit, and the fatal error should no longer appear.
Step 4: Identify Heavy Plugins or Themes
If increasing memory only temporarily hides the problem, a plugin, theme, or custom code may be consuming excessive resources.

4.1 Temporarily Deactivate All Plugins
- Log in to Dashboard ? Plugins ? Installed Plugins.
- Check the box at the top of the list to select all plugins.
- From the Bulk actions dropdown, choose Deactivate and click Apply.
- Test the page that was failing.
What You Should See
If the error disappears with all plugins deactivated, one of them is the cause.
4.2 Reactivate Plugins One by One
- Return to Plugins ? Installed Plugins.
- Reactivate plugins one at a time.
- After each activation, reload the problematic page.
- When the error returns, the last plugin you activated is likely the culprit.
4.3 Switch to a Default Theme
If deactivating plugins doesn’t help, test your theme:
- Go to Appearance ? Themes.
- Activate a default theme such as Twenty Twenty-Five.
- Test the page again.
If the error disappears, your original theme may have heavy or poorly optimized code.
Step 5: Enable Debugging for More Detail (Optional)
If the cause is still unclear, WordPress debugging can reveal which file or function is exhausting memory.
5.1 Turn On WP_DEBUG Safely
- Edit
wp-config.phpagain. - Find any existing
WP_DEBUGlines and adjust them to:
define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false );
- Save and upload the file.
- Visit the page that triggers the error again.
WordPress will log errors to wp-content/debug.log.
5.2 Review debug.log
- In your file manager or FTP, open wp-content/debug.log.
- Scroll to the bottom for the most recent entries.
- Look for repeated references to a specific plugin, theme file, or custom code.
What You Should See
You should see error entries that point to particular files or functions. Share these with your developer or plugin/theme support if you need help optimizing or fixing the code.
Step 6: Clean Up and Optimize After Fixing
Once the immediate error is resolved, take a few steps to reduce the chance of it returning.
6.1 Remove or Replace Problem Plugins/Themes
- Uninstall plugins that caused memory issues if you can live without them.
- Look for lighter alternatives that provide the same functionality.
- Keep only the plugins you truly need.
6.2 Keep Everything Updated
- Update WordPress core, themes, and plugins regularly.
- Ensure your PHP version is supported and reasonably current.
6.3 Disable Debug Mode
After you’re done troubleshooting, turn off debugging to avoid large log files:
define( 'WP_DEBUG', false ); define( 'WP_DEBUG_LOG', false ); define( 'WP_DEBUG_DISPLAY', false );
When to Contact Compass Production or Your Host
Reach out for professional help if:
- Increasing memory and disabling plugins/themes does not resolve the error.
- Your host refuses to raise the PHP memory limit to a reasonable level.
- debug.log shows complex errors in custom code you’re not comfortable editing.
What You Should See After a Successful Fix
- No more “Allowed memory size exhausted” messages.
- Normal access to both the front end and the WordPress dashboard.
- Stable performance when editing pages, running imports, or using page builders.
Document the changes you made (memory values, plugins removed, theme changes) so future troubleshooting is faster and easier.