How to Increase the WordPress Memory Limit (2026): 4 Ways to Fix the Memory Exhausted Error

In this guide


Learning how to increase WordPress memory limit settings is one of the most useful fixes a site owner can know. The dreaded “Fatal error: Allowed memory size exhausted” message can take down your whole site — front end, admin area, and all.

The good news: the fix is free, takes about five minutes, and needs no coding experience. This guide shows you four proven methods to increase WordPress memory limit values, which one to try first, and how to confirm the change worked.

Laptop showing the WordPress dashboard with a memory warning — how to increase WordPress memory limit in 2026

What Is the WordPress Memory Limit?

The WordPress memory limit is the maximum server RAM that PHP — the language WordPress runs on — may use while building a page. Every visit loads WordPress core, your theme, your plugins, and your page content into memory.

By default, WordPress tries to set its own limit to 40 MB for a single site and 64 MB for a multisite network, through two core constants: WP_MEMORY_LIMIT (40M, or 64M on multisite) and WP_MAX_MEMORY_LIMIT (256 MB, for admin tasks).

Here is the catch: the WordPress limit is only a request, not a guarantee. Your hosting server has its own PHP memory_limit, and WordPress can never exceed that server-level cap. If your host caps PHP memory at 128 MB, setting WP_MEMORY_LIMIT to 256 MB will not magically give you 256 MB.

That is why this guide works from the inside out — WordPress first, then PHP, then the host — to increase WordPress memory limit step by step. For most modern sites, 40 MB is simply too little: a page builder, a security plugin, and an SEO plugin can easily need 128 MB together.

Why the “Memory Exhausted” Error Happens

The error usually reads: “Fatal error: Allowed memory size of 134217728 bytes exhausted.” That number is in bytes — 134,217,728 bytes is 128 MB — the exact ceiling your site hit. The most common triggers:

  • A heavy plugin or theme. Page builders, membership plugins, and security suites are the usual suspects.
  • Too many plugins at once. Each active plugin adds to the memory bill on every page load.
  • Large image uploads. WordPress creates several resized copies of every image in memory.
  • Backups and imports. Backup plugins, migration tools, and bulk importers load large amounts of data at once.
  • A low hosting plan. Budget shared hosting sometimes caps PHP memory at 64 MB or 128 MB.

The fix is almost always to increase WordPress memory limit values so the site has room to breathe — and if the error returns, to find which plugin or process is eating the memory.

How to Check Your Current Memory Limit

Before you increase WordPress memory limit settings, find out what your limit actually is. You need a “before” number to confirm the fix worked afterwards.

WordPress has a built-in tool for this: log in to your dashboard and go to Tools > Site Health > Info > Server. Look for the “PHP memory limit” line — it shows the value PHP is currently allowed to use.

WordPress Site Health screen showing the server memory limit

If Site Health shows 128 MB or less and your site throws memory errors, you have found the problem. If it already shows 256 MB or more, the limit is not your issue — skip to the troubleshooting section.

How to Increase WordPress Memory Limit: The 4 Methods Compared

There are four ways to increase WordPress memory limit values, and they are not equal — the right choice depends on what access your host gives you. Start with Method 1, which works on almost every host, and move down only if the previous method does not change the number in Site Health.

Method Where you edit Difficulty Access needed Works when
1. wp-config.php Site root folder Easy File Manager or FTP Host lets WordPress raise the limit
2. php.ini / .user.ini Server PHP config Medium File Manager, FTP, or SSH Host allows custom PHP settings
3. .htaccess Site root folder Easy File Manager or FTP Apache with PHP as a module
4. Hosting panel / support Host dashboard Easy Hosting account login Host locks PHP settings

A warning for every method below: back up your site before editing any of these files. A single typo in wp-config.php or .htaccess can take your site down. Our WordPress backup guide covers a full backup in under ten minutes — do that first, and keep a copy of each file you edit.

This is the standard WordPress method to increase WordPress memory limit values, and the one to try first. The wp-config.php file lives in the root folder of your WordPress installation — the same folder that contains wp-admin, wp-content, and wp-includes. Reach it through your hosting panel’s File Manager, an FTP client such as FileZilla, or SSH.

Code editor showing the wp-config.php file used to increase WordPress memory limit

Follow these steps to increase WordPress memory limit with wp-config.php:

  1. Download a copy of wp-config.php to your computer. If anything goes wrong, upload the original and your site is back.
  2. Open the file for editing in File Manager or your text editor.
  3. Find the line that says /* That's all, stop editing! Happy publishing. */ (older installs say “Happy blogging” instead).
  4. Just above that line, add this code:
    define( 'WP_MEMORY_LIMIT', '256M' );
    define( 'WP_MAX_MEMORY_LIMIT', '512M' );
    
  5. Save the file and upload it back if you edited it locally.

The first line allows up to 256 MB on normal page loads. The second is optional: it raises the limit to 512 MB for admin-only work such as updates and image processing.

Placement matters: the lines must go above the “That’s all, stop editing!” comment — anything after the require_once ABSPATH . 'wp-settings.php'; line runs too late. The official WordPress.org documentation on editing wp-config.php explains the file’s structure in full.

After saving, check Site Health again. If it now reads 256 MB, the fix worked. If it still shows the old value, your host enforces a server-level cap — move to Method 2 or Method 4.

Do not set the value absurdly high: 1024M does not give you a gigabyte of RAM, because your host’s cap still applies.

Method 2: Edit php.ini or .user.ini

If wp-config.php did not change the number, the server-level PHP limit is the bottleneck. This method lets you increase WordPress memory limit at the PHP level instead.

The php.ini file is PHP’s main configuration file. On shared hosting you usually cannot edit the server-wide php.ini, but many hosts let you create your own override file to increase WordPress memory limit. Hosts using PHP-FPM or CGI — most shared hosting today — read a .user.ini file in your site’s root folder. Add this single line to it:

memory_limit = 256M

If your host gives you access to a real php.ini file (common on VPS and dedicated servers), find the memory_limit line, change it to 256M, then restart your web server or PHP service.

After the change, verify it in Site Health. If the number still has not moved, your host is overriding the value at a level you cannot reach — time for Method 4.

Method 3: Edit .htaccess (Apache Only)

The .htaccess file is another way to increase WordPress memory limit settings, but only on Apache servers running PHP as an Apache module. If your host uses Nginx — as Kinsta, WP Engine, and many modern hosts do — this method will not work, and adding the line can cause a 500 error. Check your server type in Site Health before trying it.

If you are on Apache, the .htaccess file sits in the same root folder as wp-config.php. It is a hidden file, so set your File Manager or FTP client to show hidden files. Back it up, then add this line at the top:

php_value memory_limit 256M

Save the file and check your site immediately. If you see a 500 Internal Server Error, remove the line at once — your server does not allow php_value overrides. Our guide to fixing the WordPress 500 internal server error covers the other common causes.

Treat this as a fallback way to increase WordPress memory limit: Method 1 is safer and works on more hosts.

Method 4: Use Your Hosting Panel or Ask Your Host

Many modern hosts — especially managed WordPress hosts — lock PHP settings so customers cannot change them by editing files. If you cannot increase WordPress memory limit by editing files, the setting lives in the hosting panel instead, and that is not a dead end.

Look in your hosting dashboard for PHP Settings or Select PHP Version (in cPanel, under “Select PHP Version” and then the “Options” tab). Change the value to 256M and save.

If there is no such option, open a support ticket and ask: “Please raise the PHP memory_limit for my WordPress site to 256M.” Most hosts apply it within minutes at no cost.

If your host refuses to increase WordPress memory limit values, or wants a far more expensive plan just for 256 MB of memory, reconsider the host. Our roundup of the best WordPress hosting in 2026 compares hosts with generous memory limits on entry plans, and our guide on how to speed up WordPress shows how a leaner setup reduces memory pressure.

How Much Memory Should You Set?

More is not always better when you increase WordPress memory limit. The right value depends on what your site actually does:

Site type Recommended limit Why
Simple blog or brochure site 128M Few plugins, light theme
Typical business site with a page builder 256M The standard recommendation for most sites
WooCommerce store or membership site 512M Carts and checkout need headroom
Large multisite network 512M Shared memory across many sites adds up fast

Whatever value you choose when you increase WordPress memory limit, remember it is a ceiling, not a reservation: WordPress only uses what it needs. WordPress itself recommends 256 MB as a healthy baseline, and the WordPress Developer Handbook documents the WP_MEMORY_LIMIT constant.

Resist jumping straight to 1024M: a site that genuinely needs a gigabyte of PHP memory to load a page has a deeper problem — a plugin with a memory leak or a theme running enormous queries.

What to Do If Raising the Limit Does Not Work

Sometimes you increase WordPress memory limit values, confirm 256 MB in Site Health, and the error still appears. The limit was never the real problem — a plugin, theme, or task is consuming memory without limit. Work through these steps to find why the error survives after you increase WordPress memory limit:

  1. Deactivate all plugins. If the error disappears, reactivate them one by one, reloading the failing page after each one — the plugin that brings the error back is the culprit.
  2. Switch to a default theme such as Twenty Twenty-Five. If the error vanishes, your theme is the problem.
  3. Check your error log. It shows the exact file and line where memory ran out.
  4. Look at scheduled tasks. A stuck cron job, a backup that never finishes, or an import loop can eat memory in the background.
  5. Scan for malware. Infected sites often run hidden scripts that consume enormous memory, so scan if the usage appeared suddenly with no plugin changes. Our WordPress security checklist walks through a full scan and lockdown.

If none of this helps, the error may be a symptom of a different failure — a broken database connection, for example, can cascade into memory errors. Our guides to fixing WordPress 404 errors and error establishing a database connection in WordPress cover the errors often confused with it.

Frequently Asked Questions

What is the default WordPress memory limit?

WordPress tries to set 40 MB for a single site and 64 MB for a multisite network, through the WP_MEMORY_LIMIT constant. The actual limit, though, is your hosting server’s PHP memory_limit, which WordPress can never exceed.

Is it safe to increase WordPress memory limit?

Yes. When you increase WordPress memory limit to 256 MB, it is safe and officially documented — the WordPress Developer Handbook explains the WP_MEMORY_LIMIT constant for this exact purpose. The limit is a ceiling, not a reservation: WordPress only uses what it needs. Just back up wp-config.php before editing, and do not set extreme values such as 2048M.

Why does the memory exhausted error keep coming back after I increase WordPress memory limit?

Because the limit was treating a symptom, not the cause. A plugin with a memory leak or a stuck backup job will eventually exhaust any limit you set. Deactivate plugins one by one to find the culprit, then fix or replace it instead of raising the limit again.

Can I increase WordPress memory limit without a plugin?

Yes — and you should. The wp-config.php method needs no plugin at all, just one line of code above the “That’s all, stop editing!” comment. Plugins that change the limit only write the same constant for you, while adding another plugin to the memory bill.

What is the difference between WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT?

WP_MEMORY_LIMIT (default 40 MB, or 64 MB on multisite) applies to ordinary front-end requests. WP_MAX_MEMORY_LIMIT (default 256 MB) applies to admin-side tasks such as updates and image processing. Setting both — 256M and 512M — covers normal browsing and heavy admin work alike.

Conclusion

The “memory exhausted” error looks alarming, but the fix is straightforward: increase WordPress memory limit values to 256 MB using wp-config.php, verify the change in Site Health, and move to php.ini, .htaccess, or your hosting panel only if the first method does not take effect. The whole process is free and takes five minutes.

If the error returns after you increase WordPress memory limit, do not keep raising it — find the plugin or theme eating the memory and fix that instead. A healthy site runs comfortably on 256 MB; a site that needs far more is telling you something is wrong under the surface.

Fix the limit today, and your site will stop crashing at the worst possible moments.

Leave a Comment