Knowing how to increase the WordPress memory limit is one of the most valuable troubleshooting skills any site owner can have, because a low memory limit is behind a surprising number of frustrating errors, white screens, and plugin failures. When WordPress does not have enough PHP memory to complete a task, it throws a fatal error and your site grinds to a halt. Fortunately, raising the limit is straightforward once you know which file to edit and what value to set. This guide walks you through every method, from the simplest one-line fix to server-level configuration, so you can choose the approach that suits your hosting environment.
What Is the WordPress Memory Limit and Why Does It Matter?
PHP, the language WordPress is built on, allocates a maximum amount of RAM to each running script. This ceiling is called the PHP memory limit. WordPress adds its own layer on top, called the WordPress memory limit, which is defined by the WP_MEMORY_LIMIT constant. If a page load, plugin action, or background task needs more memory than either limit allows, PHP kills the process and returns a memory exhaustion error.
Common Symptoms of a Low Memory Limit
- A white screen of death (WSOD) with no error message
- The error message:
Fatal error: Allowed memory size of XXXXXX bytes exhausted - Plugins failing to activate or save settings
- The WordPress admin dashboard timing out or loading incompletely
- Image uploads failing partway through
- WooCommerce orders or checkout pages not processing
How Much Memory Does WordPress Need?
WordPress itself recommends a minimum of 64 MB, but most modern sites with themes, page builders, and e-commerce plugins need 256 MB or more. WooCommerce stores and sites using Elementor or Divi often require 512 MB. Check your current limit first before deciding what value to set.
How to Check Your Current WordPress Memory Limit
Before making any changes, confirm exactly how much memory is currently allocated to your WordPress installation.
Method 1: Use the WordPress Site Health Tool
- Log in to your WordPress dashboard.
- Navigate to Tools → Site Health.
- Click the Info tab.
- Expand the Server section.
- Look for the PHP memory limit and WordPress memory limit rows to see the current values.
Method 2: Use a phpinfo() Page
If you have access to your server, create a temporary PHP file containing <?php phpinfo(); ?>, upload it to your root directory, visit it in a browser, and search for memory_limit. Delete the file immediately after checking, as leaving it public is a security risk.
Method 1: Edit wp-config.php (Recommended First Step)
The wp-config.php file sits in the root of your WordPress installation and controls core configuration constants. Adding or updating the WP_MEMORY_LIMIT constant here is the quickest way to increase the WordPress memory limit without touching server files.
Step-by-Step Instructions
- Connect to your server via FTP, SFTP, or your hosting control panel's file manager.
- Navigate to the root of your WordPress installation (the folder containing
wp-config.php,wp-login.php, and thewp-contentfolder). - Download a backup copy of
wp-config.phpbefore making any edits. - Open
wp-config.phpin a text editor. - Find the line that reads
/* That's all, stop editing! Happy publishing. */. - Add the following lines above that comment:
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );
The first constant raises the limit for the front end and general WordPress operations. The second raises it for the admin area (which is set separately in WordPress). Save the file, re-upload it, and revisit your site to confirm the error is resolved. You can verify the new value in Tools → Site Health → Info → Server.
Important Caveat
WordPress can only request memory up to the ceiling set by PHP itself. If your server's PHP memory limit is lower than the value you set in wp-config.php, WordPress cannot exceed the server ceiling. In that case, you must also raise the PHP memory limit using one of the methods below.
Method 2: Edit the .htaccess File (Apache Servers)
If your hosting runs Apache and grants you the ability to override PHP settings via .htaccess, you can raise the PHP memory limit directly from there. This method affects all PHP scripts running in that directory, not just WordPress.
Step-by-Step Instructions
- Locate the
.htaccessfile in your WordPress root directory. It may be hidden; enable hidden files in your FTP client or file manager. - Download a backup copy before editing.
- Open the file in a text editor and add the following line:
php_value memory_limit 256M
- Save and re-upload the file.
- Clear any server-side or plugin caches.
- Test your site and verify the new limit in Site Health.
Note: On some shared hosts, this directive is disabled for security reasons. If you see a 500 Internal Server Error after saving, remove the line you added — your host does not permit PHP value overrides in .htaccess. In that case, move on to Method 3 or contact your host.
Method 3: Edit php.ini or Create a Custom php.ini
The php.ini file is PHP's master configuration file. Editing it gives you the most direct control over the memory limit, but access depends on your hosting type.
On Shared Hosting (Custom php.ini)
Many shared hosts allow you to place a custom php.ini file in the root of your site to override server defaults.
- Create a new file named
php.iniin a plain text editor. - Add the following line:
memory_limit = 256M
- Upload this file to your WordPress root directory (same location as
wp-config.php). - Restart PHP-FPM if your host gives you that option, or contact support to confirm the file is being read.
On VPS or Dedicated Servers
- Connect to your server via SSH.
- Locate your active
php.inifile. Runphp --inito find its path. - Open the file with a text editor such as nano:
sudo nano /etc/php/8.1/cli/php.ini(replace the path with your actual path). - Find the line
memory_limit = 128M(or whatever the current value is). - Change it to your desired value, for example
memory_limit = 256M. - Save the file and restart your web server or PHP-FPM service:
sudo systemctl restart php8.1-fpm
sudo systemctl restart apache2
Method 4: Use WP-CLI to Verify and Manage the Limit
If you have WP-CLI installed on your server, you can quickly check and confirm WordPress configuration values from the command line without logging in to the dashboard. This is especially useful for developers managing multiple sites or working in automated deployment pipelines.
Check the Current Memory Limit via WP-CLI
wp eval 'echo WP_MEMORY_LIMIT;'
This command outputs the current value of the WP_MEMORY_LIMIT constant as WordPress sees it, giving you instant confirmation that your wp-config.php change took effect.
Useful Related WP-CLI Commands
wp config get WP_MEMORY_LIMIT— retrieves the constant fromwp-config.phpwp config set WP_MEMORY_LIMIT 256M --raw— sets the value directly from the CLI without manually editing the filewp site health— (requires WP-CLI >= 2.5) runs a quick health check that includes server info
Troubleshooting: When Nothing Seems to Work
If you have tried all the methods above and the memory limit has not changed, work through the following checklist before contacting your host.
Check Which php.ini Is Actually Being Loaded
PHP can load different configuration files for the CLI (command line) and for the web server. A change to the CLI php.ini will not affect web requests. Use the phpinfo() method described earlier to confirm which configuration file the web server is reading and that your changes appear there.
Clear All Caches
Object caches, page caches, and opcode caches (OPcache) can serve stale PHP configuration data. After making any change, flush your plugin caches, WordPress transients, and restart PHP-FPM or the web server to ensure the new settings are picked up.
Contact Your Hosting Provider
Some managed hosting providers (such as WP Engine, Kinsta, and Flywheel) lock PHP settings at the server level and do not allow them to be overridden via .htaccess or custom php.ini files. In these cases, you must contact support and request a memory limit increase. Most managed hosts will accommodate reasonable requests, especially if you can demonstrate a legitimate need such as a resource-heavy plugin or WooCommerce.
Audit Resource-Hungry Plugins and Themes
Raising the memory limit is the right fix when a legitimate task genuinely needs more RAM. However, if a plugin has a memory leak or is poorly coded, simply increasing the limit will delay rather than solve the real problem. Use a profiling plugin such as Query Monitor to identify which plugin or theme is consuming the most memory, and consider replacing it with a more efficient alternative.
Frequently Asked Questions
What is the recommended WordPress memory limit?
WordPress recommends a minimum of 64 MB, but most modern sites need at least 256 MB. Sites running WooCommerce, Elementor, Divi, or other resource-heavy tools often benefit from 512 MB. Start at 256 MB and increase only if you continue to see memory errors.
Will increasing the memory limit slow down my site?
No. Raising the memory limit does not make your site slower. It simply allows PHP scripts to use more RAM when they need it. Unused memory is not consumed — PHP only allocates RAM up to what a given request actually requires. A higher ceiling just prevents crashes when demand spikes.
Why is my WordPress memory limit still showing the old value after editing wp-config.php?
The most common reason is that the server's PHP memory limit is lower than the value you set in wp-config.php. WordPress cannot exceed the PHP ceiling regardless of what WP_MEMORY_LIMIT says. You must also raise the PHP memory limit via .htaccess, php.ini, or by asking your host. Additionally, make sure you cleared all caches and that you edited the correct wp-config.php file.
Is it safe to set the WordPress memory limit very high, like 1 GB?
Setting an unnecessarily high limit is generally safe but wasteful on shared hosting where RAM is finite and shared among many users. On a VPS or dedicated server, set the limit high enough to accommodate your peak traffic and plugin needs with some headroom — typically 256 MB to 512 MB covers the vast majority of WordPress sites. Only go higher if profiling tools show a specific, justified need.
Managing server-level settings like the WordPress memory limit can feel daunting, especially when you are juggling multiple files and hosting environments. If you would rather skip the manual steps entirely, WP AI Agent is an AI-powered tool that lets you manage tasks like this — and dozens of other WordPress configuration and maintenance jobs — simply by typing what you need in plain language, with no file editing required.