Backed by Awesome Motive.
Learn more on our Seahawk Blog.

Fix Memory Exhausted Error in WordPress: Step-by-Step Guide

Written By: author avatar Komal Bothra
author avatar Komal Bothra
Hey, I’m Komal. I write content that speaks from the heart and makes WordPress work for you. Let’s make your ideas come alive!
Fix Memory Exhausted Error in WordPress

Imagine working on your WordPress website, only to be greeted by the dreaded “Fatal error: Allowed memory size of xxx bytes exhausted.” It’s a frustrating experience that can halt your site’s functionality and even cause it to crash entirely. This issue, commonly known as the memory exhausted error, happens when your WordPress website exceeds the PHP memory limit set by your hosting provider.

If you’ve encountered this error, don’t worry—you’re not alone, and it’s entirely fixable. In this guide, we’ll break down what causes the memory exhausted error and walk you through practical solutions to get your WordPress site back up and running smoothly.

What Is a WordPress Memory Exhausted Error?

WordPress Memory Exhausted Error

The WordPress memory exhausted error occurs when your WordPress website exceeds the maximum amount of memory allocated for PHP (the language that runs WordPress). When WordPress or any plugin/theme on your site tries to use more memory than allowed, the site crashes, and you’ll see this error message.

For instance, when you upload large images, run complex queries, or use poorly optimized plugins, the system can run out of memory.

This error typically manifests in two ways:

  • A fatal error message with the text “Allowed memory size of xxx bytes exhausted.”
  • The white screen of death (WSOD), where your website goes completely blank without any clear error message.

If your website is sluggish, experiencing crashes, or showing errors, you’re probably dealing with a memory limit issue.

Tired of Memory Exhaustion Errors in WordPress?

Stop dealing with frustrating memory limits and slow website performance! Our WordPress specialists are ready to optimize your site, increase PHP memory limits, and resolve all server-related issues for a smoother experience.

Common Causes of Memory Exhaustion Error

There are several reasons why you may run into a memory exhausted error:

  • Inefficient plugins or themes: Some WordPress plugins may consume more memory than necessary due to bad coding or memory leaks.
  • Large media files: Uploading large images or videos can use a significant portion of your site’s memory.
  • High traffic: As traffic increases, more server resources, including memory, are required to handle visitor requests.
  • Low default memory limits: Many shared hosting providers set low PHP memory limits, which can cause this error, especially on larger websites.

Now that we know the causes, let’s go through the steps to fix the error.

Read: Hiring a WordPress Support Agency? Crucial Questions to Ask

Increase PHP Memory Limit in WordPress to Resolve Memory Exhausted Error

PHP-memory-limit-worpdress

The most common way to resolve the memory exhausted error in WordPress is by increasing the PHP memory limit. PHP is the scripting language used by WordPress, and increasing its memory allocation can help your site run smoothly.

Modify wp-config.php to Increase Memory

The first and easiest method to increase the memory limit is by editing your wp-config.php file. This file is located in the root folder of your WordPress installation. Here’s how to do it:

  1. Access your website’s files: You can do this via FTP or through your hosting provider’s file manager.
  2. Locate wp-config.php: It’s usually found in the root directory (public_html or www).
  3. Edit the file: Open the wp-config.php file and look for a line that says /* That’s all, stop editing! Happy blogging. */

Add the following code just before this line:
define( ‘WP_MEMORY_LIMIT’, ‘256M’ );

This increases the memory limit to 256 MB, which is sufficient for most websites.

  1. Save the file and refresh your website.

This solution works in many cases and should solve the memory exhausted error by allocating more resources to WordPress.

Learn: Safely Update WordPress from Version PHP 7 Without Breaking the Site

Update .htaccess for Memory Limit Increase

Update .htaccess for Memory Limit Increase

If editing the wp-config.php file didn’t work, you can also try modifying the .htaccess file:

  1. Locate the .htaccess file: Like wp-config.php, this file is located in the root directory of your WordPress installation.

Add the following line to increase the memory limit:
php_value memory_limit 256M

  1. Save the file and check if the error has been resolved.

Contact Your Hosting Provider

contact your hosting provider

If you’ve tried both the wp-config.php and .htaccess methods and are still seeing the memory exhausted error, it may be time to contact your WordPress hosting provider. Some hosting providers set strict memory limits at the server level, which means you can’t override them via your website’s files.

Contact your host and ask them to increase the PHP memory limit for your site. In many cases, they can increase this limit to resolve the issue. If they can’t or won’t, it may be time to consider upgrading your hosting plan or switching to a better host.

How to Identify WordPress Plugins Causing High Memory Usage

Sometimes, plugins are the culprit behind memory exhaustion. If a plugin is using an excessive amount of resources, even increasing the memory limit won’t fully solve the problem.

Here’s how you can identify if a plugin is causing the issue:

  • Disable all plugins: Go to the plugins section of your WordPress dashboard and disable all plugins. Then, enable them one by one to see which one is causing the memory usage to spike.
  • Use Query Monitor: Install a tool like Query Monitor, which can show you detailed information about how much memory each plugin or theme is using.

Once you identify the plugin, consider removing it or finding a more optimized alternative.

Explore: How to do Emergency WordPress Troubleshooting of Issues

Best Practices to Prevent Memory Exhaustion Error in WordPress

Prevent Tips for Memory Exhaustion in WordPress

To prevent the memory exhausted error from happening again, it’s important to keep your WordPress site optimized. Here are some essential best practices to follow:

Choose Lightweight Themes and Plugins

Avoid using themes and plugins that are bloated with unnecessary features or poorly coded. These can consume excessive amounts of memory, slowing down your site and triggering memory exhaustion. Opt for well-optimized, lightweight alternatives that provide the functionality you need without overloading your resources.

Check: Fastest WordPress Themes

Optimize Your Database Regularly

Your WordPress database can accumulate unnecessary data, such as post revisions, transients, and old drafts, which can take up valuable memory. Use a plugin like WP-Optimize to clean up your database and improve performance. Regular database maintenance helps free up resources and ensures your site runs efficiently.

Find: Best WordPress Database Plugin

Enable Caching for Faster Load Times

Implementing caching can significantly reduce the load on your server by storing copies of your website’s pages and serving them to visitors without running complex database queries every time. You can either opt for caching plugins or professional site speed optimization services to enhance your site’s speed and reduce memory usage.

Keep Everything Up-to-Date

Ensure that your WordPress core, themes, and plugins are always updated to their latest versions. Updates often contain performance improvements, security patches, and bug fixes that can help prevent memory-related issues. Outdated software is more likely to have vulnerabilities and inefficiencies that could lead to memory exhaustion.

Monitor Website Performance Regularly

Use tools like Google PageSpeed Insights to monitor your website’s performance and identify potential bottlenecks. These tools can highlight elements that are slowing down your site, such as large images, unoptimized code, or slow-loading scripts, allowing you to address issues before they become critical.

Find: How to Improve Google PageSpeed Insights on WordPress?

When to Upgrade Your Hosting Plan for Memory Exhausting Issues

Upgrade Your Hosting Plan for Memory Issues

If you’ve tried increasing your PHP memory limit and optimizing your site but are still seeing memory errors, it might be time to upgrade your hosting plan. Some shared hosting plans offer low memory limits, which can be insufficient for growing websites with high traffic or complex functionalities.

When choosing a new hosting plan, look for one with:

  • Higher memory limits and better server resources.
  • Scalable hosting solutions that allow your website to grow.
  • Optimized hosting for WordPress, with features designed to handle WordPress-specific issues like memory exhaustion.

Popular hosting providers such as DreamHost, Kinsta, and Pressable offer hosting plans with better memory management, which can prevent future memory errors.

Wrap Up

The memory exhausted error in WordPress is a common issue, but thankfully, it’s easy to fix. By increasing your PHP memory limit, optimizing plugins, and choosing the right hosting plan, you can keep your site running smoothly without interruptions. Regularly maintaining and optimizing your WordPress setup will help you avoid hitting memory limits in the future. 

If your website has outgrown its current resources, consider upgrading your hosting for more memory capacity. By taking these steps, you’ll ensure that your website performs efficiently and remains accessible to your visitors.

FAQs

How can I monitor WordPress memory usage?

Use tools to track memory usage by plugins, themes, and other elements of your website.

What causes WordPress memory exhaustion?

The primary causes include inefficient plugins, large media files, high traffic, and low memory limits set by your hosting provider.

What is the recommended PHP memory limit for WordPress?

For most WordPress websites, 256MB is sufficient. However, larger sites with heavy traffic may require more.

Related Posts

Have you ever thought about how great it would be to white-label WordPress admin dashboard?

Media files are a crucial part of any WordPress website, but they can also be

Want to install WordPress on Windows for local development? Installing WordPress on Windows 11 is

Komal Bothra February 17, 2025

How to White-Label WordPress Admin Dashboard: Your Best Guide

Have you ever thought about how great it would be to white-label WordPress admin dashboard?

WordPress
Komal Bothra February 14, 2025

How to Install WordPress on Windows 11 (5 Easy Ways)

Want to install WordPress on Windows for local development? Installing WordPress on Windows 11 is

Tech WordPress
Komal Bothra February 13, 2025

Google Cache Pages Removed? View Google Cache Easily

Ever stumbled upon a webpage that’s suddenly missing or recently updated, but you need to

Tech

Get started with Seahawk

Sign up in our app to view our pricing and get discounts.