If your WordPress site shows Fatal error: Allowed memory size of 268435456 bytes exhausted, a PHP process asked for more memory than the server allows. The fix is usually quick. The catch is that the common fix, one line in wp-config.php, fails on many sites because it changes the wrong layer.
Decode the number first
The limit is reported in bytes:
| Bytes | Limit |
|---|---|
| 33554432 | 32 MB |
| 67108864 | 64 MB |
| 134217728 | 128 MB |
| 268435456 | 256 MB |
| 536870912 | 512 MB |
The end of the message gives a file path. The folder after /wp-content/plugins/ or /wp-content/themes/ is your first suspect.
Three layers decide the limit
-
Host or php.ini
memory_limitis the real ceiling. -
WP_MEMORY_LIMITin wp-config.php is only a request, capped by layer 1. -
Per-folder overrides such as
.user.inior.htaccess.
The smallest value wins. Ask WordPress for 256M on a 128M host and you still get 128M.
Fix 1: wp-config.php
Back up the file first, then add this above the "That's all, stop editing" line:
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );
Fix 2: php.ini, .user.ini or the hosting panel
memory_limit = 256M
Most panels expose this as a PHP settings or INI editor page. On PHP-FPM hosts, a per-site .user.ini is usually the file that is read, and it can take a few minutes to apply.
Fix 3: .htaccess (Apache with mod_php only)
php_value memory_limit 256M
On PHP-FPM or FastCGI this directive causes a 500 error. Remove it immediately if that happens.
If nothing changes
Open Tools → Site Health → Info → Server and read the PHP memory limit. If it still shows the old value, the change did not reach the right layer. Also check that you edited the right wp-config.php, that the line sits above the stop-editing comment, and that no cache is serving the old error.
Find the real culprit
Raising the limit hides the problem. To find it, log errors without showing them to visitors:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
Repeat the failing action, read wp-content/debug.log, and note the plugin path. Rename that plugin folder over SFTP to deactivate it and retest. A diagnostic plugin like Query Monitor, run on staging, shows memory per page and per plugin.
FAQ
Is it safe to raise the memory limit? Yes, going from 64M or 128M to 256M is routine. Avoid extreme values on shared hosting, and fix the cause if you keep needing more.
Why does the error only show in wp-admin? Image processing, updates and imports need more memory than front-end page views.
Will more memory speed up my site? No. Memory prevents crashes. Speed comes from caching, lighter plugins and good hosting.
The full guide, with a symptom-to-cause table and prevention checklist, is on my site: WordPress memory exhausted fix.
Top comments (0)