How to Fix the WordPress Memory Exhausted Error – Increase PHP Memory

This can be caused by:

  • Too many plugins or themes taking up too much memory.
  • High website traffic or lots of content.
  • Poorly coded plugins or themes that use more memory than they should.
  • Large images or media files being processed.
WordPress Memory Exhausted Erro
How to Fix It:

Here are some easy ways to increase the PHP memory limit and fix the error:

1. Increase PHP Memory Limit in wp-config.php

  • Go to your WordPress root folder (using FTP or your file manager).
  • Open the wp-config.php file.
  • Add this line just before “That’s all, stop editing! Happy blogging”:

    define( ‘WP_MEMORY_LIMIT’, ‘256M’ );
    • You can change 256M to 128M, 512M, or whatever works for you based on your host’s limits.

2. Increase Memory in .htaccess (for Apache users)

  • Access your WordPress root folder.
  • Find and open the .htaccess file (it might be hidden, so show hidden files if needed).
  • Add this line at the top:
    bash
    php_value memory_limit 256M

3. Increase Memory in php.ini

  • If your host allows access to php.ini, find or create this file in your WordPress root directory.
  • Add this line:
    bash
    memory_limit = 256M
  • Some hosts might not let you change this, so contact their support if needed.

4. Contact Your Hosting Provider

If none of the above works or if you’re on a shared host with strict limits, reach out to your hosting support team. They can help increase the memory limit for you.

5. Disable or Optimize Plugins and Themes

  • Turn off any plugins you’re not using. Too many active plugins can eat up memory.
  • Make sure your plugins and themes are updated and well-coded. Old or inefficient plugins can cause problems.
  • Consider using a caching plugin like W3 Total Cache or WP Super Cache to lighten the load on your server.

6. Optimize Images and Media Files

  • Use tools like Smush, EWWW Image Optimizer, or ShortPixel to compress large images. This helps reduce memory usage during upload and processing.
  • Remove any unused media files from your library to save space.