The “Memory exhausted error” in WordPress is a common yet critical issue that can disrupt the entire functionality of your website. It typically signals that your WordPress installation has reached the memory limit allocated by your hosting provider. This can prevent plugin installations, theme updates, or even lock you out of your admin dashboard entirely. To maintain a healthy and responsive site, it’s essential to understand what causes this error and what steps you can take to resolve it efficiently and securely.
What Causes the Error?
At its core, the memory exhausted error emerges when the PHP scripts used by WordPress require more memory than the server has been permitted to allocate. This usually results in an error message that looks like:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate ... bytes)
This can be triggered by:
- Resource-intensive plugins or themes
- Large amounts of media or database queries
- Inadequate PHP memory limits set on the server
Fortunately, resolving this issue is typically straightforward. Below are the essential steps you should follow.
1. Increase the PHP Memory Limit
The first and most effective solution is to manually increase your site’s PHP memory limit. This can be done by accessing your website’s root directory using FTP or a file manager and editing the wp-config.php file.
Insert the following line just before the line that says ‘That’s all, stop editing! Happy blogging.’:
define('WP_MEMORY_LIMIT', '256M');
This sets the PHP memory limit to 256MB, which should be sufficient for most sites. If the issue persists, you may need to confirm with your hosting provider that they permit custom memory settings.
2. Modify php.ini or .htaccess (if necessary)
If altering wp-config.php
doesn’t resolve the problem, you may need to edit either the php.ini
file or your .htaccess
file.
Option A: php.ini
memory_limit = 256M
Option B: .htaccess
php_value memory_limit 256M
Keep in mind that some shared hosting environments do not allow these changes, and modifying them may cause internal server errors.

3. Deactivate Resource-Hungry Plugins
If increasing the memory limit doesn’t rectify the issue, one or more plugins could be responsible for consuming excessive resources. To troubleshoot:
- Access your site via FTP or file manager
- Navigate to
wp-content/plugins
- Rename the plugin folders one by one to temporarily deactivate them
Refresh your site after each renaming to identify the culprit. Once found, consider replacing the plugin with a more optimized alternative.
4. Switch to a Default Theme
In some cases, themes with heavy scripts or functions may exhaust the available memory. It’s advisable to switch temporarily to a default theme like Twenty Twenty-Three to see if the issue resolves.
This can be done by going to Appearance → Themes in your dashboard or renaming your active theme folder via FTP, which will force WordPress to revert to the default theme.
5. Consult Your Hosting Provider
If none of the above solutions work, the limitation might be set at the server level by your hosting provider. Reach out to them and request an increase in the PHP memory limit. Reliable hosts will typically accommodate such requests or offer more suitable hosting plans.

6. Upgrade Your Hosting Plan
If your website continues to experience memory issues despite all fixes, it may have outgrown its current hosting environment. Consider upgrading to a:
- VPS (Virtual Private Server): Offers dedicated resources
- Managed WordPress Hosting: Optimized for WordPress performance
- Dedicated Server: Ideal for high-traffic or resource-heavy sites
Choosing the right hosting environment ensures that your website remains stable, fast, and less prone to memory errors.
Conclusion
The “Memory exhausted error” in WordPress is more than just an inconvenience—it’s a sign that your site may need optimization or better server resources. By following the steps outlined above, you can efficiently identify and resolve the issue. Remember, while temporary fixes may address the immediate problem, long-term stability often requires thoughtful investment in better infrastructure and optimized code.
A proactive approach will not only eliminate current errors but also prevent them from reoccurring, ensuring a seamless experience for your visitors.