How to Fix the Memory Exhausted Error in WordPress: A Step-by-Step Guide

How to Fix the Memory Exhausted Error in WordPress: A Step-by-Step Guide

How to Fix the Memory Exhausted Error in WordPress: A Step-by-Step Guide

Spread the love

The Memory Exhausted Error is one of the most common issues in WordPress, usually displayed as “Allowed memory size of xxxxx bytes exhausted.” This error occurs when WordPress does not have enough memory to perform the required task, often caused by plugins, themes, or scripts consuming more memory than allocated.


What Causes the Memory Exhausted Error?

The memory exhausted error usually happens due to the following reasons:

  • Insufficient PHP memory allocated to WordPress.
  • Resource-heavy plugins, themes, or custom scripts.
  • Multiple media files, especially large images or videos.
  • Low server resources from the hosting provider.

Step-by-Step Guide to Fix the Memory Exhausted Error

Step 1: Increase PHP Memory Limit

The first and most common solution is to increase your PHP memory limit.

  1. Access your site via an FTP client or your hosting provider’s file manager.
  2. Locate your wp-config.php file in the root directory.
  3. Add the following line of code just before the line that says */ That’s all, stop editing! */**:

define(‘WP_MEMORY_LIMIT’, ‘256M’);

  1. Save the file and upload it back to the server.

Increasing the limit to 256MB or higher can resolve this issue. Check if the error still persists after making the change.


Step 2: Deactivate Resource-Intensive Plugins

Certain plugins can consume too much memory. To check if plugins are the cause:

  1. Log in to your WordPress dashboard.
  2. Go to Plugins > Installed Plugins.
  3. Deactivate all plugins.
  4. Reactivate them one by one, and see if the memory exhausted error reappears after activating a particular plugin. If so, consider replacing the plugin with a more efficient one.

Step 3: Optimize Media Files

Large images or media files can consume significant server memory. Optimize your images using plugins like Smush or EWWW Image Optimizer to reduce their size without losing quality.


Step 4: Upgrade Your Hosting Plan

If your website is growing, your current hosting plan might not provide enough resources. Upgrading to a better plan or moving to a managed WordPress hosting service can help resolve memory exhaustion issues.


Conclusion

The memory exhausted error can be easily fixed by increasing your PHP memory limit and optimizing your WordPress site’s resource usage. If the problem persists, consider upgrading your hosting plan. For expert help, contact Craftwebx for WordPress troubleshooting services.

Leave a Reply

Categories