How to fix WordPress Memory Exhausted Error
Last modified: May 3, 2026
The “Fatal error: Allowed memory size of X bytes exhausted” message means WordPress hit the PHP memory limit on your server and couldn’t complete the operation. You’ll see it in the WordPress admin, on the frontend, or during plugin and theme updates — wherever WordPress runs out of memory mid-process.
WordPress defaults to a 64MB PHP memory limit on many hosts, but most modern WordPress sites need at least 128MB to 256MB to run reliably. Common triggers include:
- Installing or updating a memory-intensive plugin (page builders, backup tools, WooCommerce extensions)
- Running a large import, export, or bulk operation
- Too many plugins active simultaneously — each one consumes some memory
- A complex theme with sliders, galleries, or live search features
The fix involves increasing the PHP memory limit. There are three main methods covered below. Try Method 1 first — it works on the vast majority of hosts.
* This button will show the rest of the post and open up an offer from a vendor
Method 1: Edit wp-config.php
The most reliable way to increase the WordPress memory limit is to add a single line to your wp-config.php file, which sits in the root of your WordPress installation.
Via FTP (FileZilla or similar):
- Log into your server via FTP using your host credentials — these are different from your WordPress admin login.
- Navigate to the root WordPress folder (usually
public_htmlorwww). - Find
wp-config.php, right-click, and open it in a text editor. - Find the line that reads:
/* That's all, stop editing! Happy blogging. */ - Add the following line immediately before that line:
define( 'WP_MEMORY_LIMIT', '256M' );
- Save the file and re-upload it, overwriting the original.
Via hosting file manager (no FTP needed): Most hosts (cPanel, Plesk, Cloudways) include a file manager in their control panel. Open it, navigate to your WordPress root folder, and edit wp-config.php directly in the browser-based editor — same change, no FTP client required.
After saving, clear your browser cache and reload the page that was showing the error.
Method 2: Edit .htaccess
If editing wp-config.php didn’t work — or if your host’s server configuration overrides it — you can try setting the PHP memory limit in your .htaccess file instead.
- Connect via FTP or your hosting file manager and navigate to the WordPress root folder.
- Find the
.htaccessfile. (If you don’t see it, make sure hidden files are visible — in FileZilla, go to Server → Force showing hidden files.) - Open
.htaccessin a text editor and add the following line:php_value memory_limit 256M
- Save and re-upload the file.
Note: this method only works on Apache servers. If you get a 500 error after saving, your server doesn’t support PHP directives in .htaccess — remove the line you added and try Method 3 instead.
Method 3: Edit php.ini
Some hosts — particularly those running Nginx or with strict Apache configurations — won’t allow PHP settings in .htaccess. In that case, create or edit a php.ini file in your WordPress root.
- In your FTP client or file manager, look for a file called
php.iniin the WordPress root folder. If it doesn’t exist, create a new blank file with that name. - Add the following line:
memory_limit = 256M
- Save and upload the file.
If your host uses a control panel like cPanel, there may also be a “PHP Configuration” or “MultiPHP INI Editor” option that lets you change memory_limit directly from the hosting panel without editing files manually.
Step 4: Verify the Fix
After applying any of the methods above, confirm the memory limit actually increased before assuming the problem is solved:
- Clear your browser cache fully (Ctrl+Shift+Del on Windows / Cmd+Shift+Delete on Mac).
- Reload the page that was producing the error.
- To confirm the new limit took effect, create a temporary file: add a new file called
phpinfo.phpto your WordPress root with this content:<?php phpinfo(); ?>
Visit
yoursite.com/phpinfo.phpand search the page formemory_limit— it should now show256M. Delete the file immediately after checking.
If the value still shows the old limit (e.g., 64M), your host may be enforcing a server-level cap that overrides your configuration files. In that case, move to Step 5.
Step 5: If the Error Persists
If you’ve tried all three methods and the memory limit won’t increase — or the error keeps appearing even after the limit is raised — there are a few more things to check:
Identify the problem plugin: A single poorly coded plugin can consume far more memory than normal. To find it:
- Go to Plugins in your WordPress admin and deactivate all plugins.
- Check if the error is gone.
- Reactivate plugins one at a time, checking after each. When the error returns, you’ve found the culprit.
- Deactivate or replace that plugin.
If you can’t access the WordPress admin due to the error, use FTP or your file manager to rename the /wp-content/plugins/ folder to /wp-content/plugins_disabled/. This deactivates all plugins at once, restoring admin access so you can reactivate them individually.
Switch to a default theme temporarily: In rare cases a memory-intensive theme is the cause. Switch to a default WordPress theme (Twenty Twenty-Four) and see if the error stops.
Contact your host: Some hosts set a hard server-side memory cap that can’t be overridden by config files. If your phpinfo.php check shows the limit didn’t change, contact your host and ask them to increase the PHP memory limit for your account.
Final Word: Learn To Fix The WordPress Memory Exhausted Error
It is easy to fix this issue when you know how. Use the above as a guide to fix the WordPress Memory Exhausted Error and be sure that you don’t have issues in the future.
Website Maintenance – Use Promocode: scanwp
Advanced JetPlugins for Elementor
Semrush 14 days trial
Kinsta – Managed WordPress Hosting
Bluehost Hosting