WordPress Fix Memory Size Exhausted Error wp config
A Complete Step-by-Step Fix
Few WordPress errors are more frustrating than seeing a message that says your website needs a wp memory limit fix. Your pages may stop loading, the WordPress dashboard may become inaccessible, or you may suddenly see a fatal error instead of your website.
The good news is that the **wordpress fix memory size exhausted error wp config** problem is usually fixable without rebuilding your website.
In many cases, WordPress simply does not have enough PHP memory available to complete a particular task. Increasing the WordPress memory limit through the `wp-config.php` file can often solve the problem quickly.
This guide explains what the error means, why it happens, how to edit `wp-config.php` safely, and what to do if increasing the memory limit does not solve the underlying problem.

The Core Basics
Before changing anything, it helps to understand what WordPress memory actually means.
WordPress runs on PHP, a server-side programming language. Every time WordPress loads a page, activates a plugin, processes an image, runs a database query, or performs another task, PHP needs a certain amount of memory.
Your hosting account places limits on how much memory PHP can use. WordPress also has its own memory settings.
When a script attempts to use more memory than PHP allows, WordPress can produce an error similar to:
`Fatal error: Allowed memory size of 134217728 bytes exhausted`
The number can vary depending on your hosting configuration.
The important part is **”Allowed memory size”**. It means PHP reached its permitted memory allocation while attempting to complete an operation.
The `wp-config.php` file is one of WordPress’s most important configuration files. It contains settings related to your database connection and other core WordPress configuration options.
One of those settings can be used to tell WordPress to request a higher PHP memory limit.
💡 WP Fix It Co Recommendation: If you are dealing with the wordpress fix memory size exhausted error wp config, a fast, secure WordPress host can help prevent resource problems and make it much easier to implement memory-limit changes smoothly. Get Hostinger WordPress Hosting here.
Step-by-Step Guide: Fix the WordPress Memory Exhausted Error
1. Back Up Your Website First
Before editing `wp-config.php`, make a backup.
This is especially important because `wp-config.php` is a critical WordPress file. A small typing mistake can cause your website to stop functioning correctly.
Ideally, have a recent backup of both:
* Your WordPress files
* Your WordPress database
If your hosting provider offers automatic backups, make sure you know how to restore one before proceeding.
2. Locate Your wp-config.php File
The `wp-config.php` file normally sits in the root directory of your WordPress installation.
Depending on your hosting setup, you may access it through:
* Your hosting file manager
* FTP
* SFTP
* SSH
If you use a hosting control panel, open the File Manager and locate your WordPress installation.
You will normally see files such as:
`wp-admin`
`wp-content`
`wp-includes`
The `wp-config.php` file should be in the same main directory.

3. Open wp-config.php Carefully
Right-click the file and choose the appropriate editing option.
Do not remove existing configuration settings unless you know exactly what they do.
You are looking for the area near the following comment:
`/* That’s all, stop editing! Happy publishing. */`
This comment is important because WordPress expects core configuration settings to be placed before it.
4. Increase the WordPress Memory Limit
Add the following line before the “That’s all, stop editing!” comment:
“`php
define( ‘WP_MEMORY_LIMIT’, ‘256M’ );
“`
This tells WordPress to use a 256 MB memory limit where the hosting environment permits it.
For many websites, 256 MB is a sensible starting point.
You may also encounter:
“`php
define( ‘WP_MAX_MEMORY_LIMIT’, ‘256M’ );
“`
This setting is particularly relevant to memory available for administrative tasks.
If your problem occurs inside the WordPress dashboard, this setting may be useful.
A common configuration is:
“`php
define( ‘WP_MEMORY_LIMIT’, ‘256M’ );
define( ‘WP_MAX_MEMORY_LIMIT’, ‘256M’ );
“`
Place these definitions before:
“`php
/* That’s all, stop editing! Happy publishing. */
“`
5. Save the File
Save the changes and return to your website.
Try loading the page that previously generated the memory error.
If the website loads normally, you have probably resolved the immediate memory-limit problem.
However, don’t stop investigating just because the error disappeared.
A memory exhaustion error can sometimes indicate that a plugin, theme, image-processing task, or other process is consuming an unusually large amount of memory.
6. Check Whether the Memory Limit Actually Changed
Sometimes you add the correct code but your hosting configuration prevents WordPress from increasing the available memory.
You can check the memory information from WordPress by going to:
Tools → Site Health → Info → Server**
Look for the PHP memory limit information.
If the available PHP memory remains lower than the value you requested, the limit may be controlled by your hosting environment.
In that situation, editing `wp-config.php` alone may not be enough.
7. Check Your Plugins
If increasing memory fixes the problem temporarily but the error keeps returning, investigate your plugins.
A poorly coded or resource-heavy plugin can consume substantial PHP memory.
Think about what happened immediately before the error appeared.
Did you:
* Install a new plugin?
* Update several plugins?
* Install a page-building plugin?
* Add an image optimisation plugin?
* Import a large amount of content?
* Change your theme?
* Install an e-commerce system?
If the problem began after installing or updating something, that change is worth investigating first.
You can temporarily deactivate plugins and test the website.
If the error disappears, reactivate them one at a time until you identify the plugin responsible.
8. Consider Your WordPress Theme
Themes can also consume memory.
A heavily customised theme containing numerous scripts, widgets, functions, and integrations may require considerably more resources than a lightweight theme.
If the problem appeared after a theme change, temporarily switching to a default WordPress theme can help determine whether the theme is contributing to the problem.
Remember that changing themes can affect your site’s appearance, so do this carefully and preferably on a staging site.
9. Contact Your Hosting Provider If Necessary
If you have increased the WordPress memory setting but PHP still reports a low limit, contact your hosting company.
Ask them what PHP memory limit is currently available to your account and whether it can be increased.
This distinction is important.
You cannot always solve a server-level memory restriction simply by adding a higher value to `wp-config.php`.
For example, requesting 512 MB in WordPress does not automatically mean your hosting account will provide 512 MB.
The server configuration ultimately determines what PHP can actually use.
Best Practices and Pro Tips
Increasing memory should be treated as a solution to a resource problem, not an excuse to ignore inefficient code.
Start with a reasonable value such as 256 MB rather than immediately requesting an extremely high allocation.
Keep WordPress, themes, and plugins updated. Developers regularly release fixes that can improve compatibility and resolve memory-related bugs.
Remove plugins you no longer use. Simply deactivating unnecessary plugins is not always enough; if you have no reason to keep one, remove it.
Use reputable plugins from reliable developers and avoid installing multiple plugins that perform the same job.
You should also monitor your hosting resources. If your website regularly approaches its limits, the problem may be that your hosting plan no longer matches your site’s requirements.
Finally, always keep reliable backups before changing configuration files.
Common Mistakes to Avoid
1. Editing the Wrong File
Make sure you are changing the actual `wp-config.php` belonging to your WordPress installation.
2. Adding Code After the Stop-Editing Comment
Place your memory definitions before:
“`php
/* That’s all, stop editing! Happy publishing. */
“`
3. Setting an Unrealistically High Limit
Do not assume that 512 MB, 1 GB, or more will automatically make WordPress faster. Excessive memory allocation can hide an underlying plugin or hosting problem.
4. Ignoring the Real Cause
If the error repeatedly returns, investigate plugins, themes, PHP configuration, and hosting resources rather than endlessly increasing the memory limit.
Conclusion & Call to Action
The wordpress fix memory size exhausted error wp config solution is often surprisingly straightforward. Adding an appropriate `WP_MEMORY_LIMIT` value to `wp-config.php` can give WordPress enough room to complete memory-intensive operations.
But remember that the memory setting is only one part of the equation. If your website repeatedly exhausts memory, look for the underlying cause.
Check your plugins, theme, PHP configuration, and hosting resources. Make changes carefully, maintain backups, and avoid simply throwing more memory at a poorly performing website.
At WP Fix It Co, our goal is to make confusing WordPress errors easier to understand and fix. When your WordPress site throws a frustrating error, start with the basics, work through the steps methodically, and you can often get your site running again without expensive technical intervention.