Increase WordPress Memory Limit
WordPress can occasionally run out of memory — usually on sites with heavy traffic, lots of features, or many plugins. It can also happen when a theme or plugin has problematic code.
When this occurs, you'll see an error like:
Allowed memory size of 19242411 bytes exhausted.Sometimes the error includes the specific file or function that triggered it, which helps pinpoint a faulty plugin or theme. In other cases, your site simply needs more memory to function properly.
Step 1 — Check your current memory limits
WordPress 5.0+ includes a built-in Site Health tool. Open it via Tools → Site Health → Info in your WordPress dashboard.
There are two limits to be aware of:
| Limit | Where it lives | What it controls |
|---|---|---|
| Server PHP limit | Server section | The maximum memory available to PHP on the server. WordPress can never exceed this value. |
| WordPress memory limit | WordPress Constants section | The memory limit WordPress applies to itself (default 40M). |
Step 2 — Understand the WordPress constants
Within the WordPress Constants section, you'll find two values:
WP_MEMORY_LIMIT— Memory limit for the front-end of your site. This is usually the value to raise when visitors are hitting fatal errors.WP_MAX_MEMORY_LIMIT— Memory limit for the admin area. Can be set higher thanWP_MEMORY_LIMITsince admin tasks (like page builders) often need more memory.
Step 3 — Increase the memory limits
To raise these limits, edit your wp-config.php file. You'll find it in your site's root directory, accessible via the File Manager or SFTP.
Look for these lines (or add them if they don't exist):
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );WP_MEMORY_LIMIT to 512M but your server limit is 168M, WordPress will be capped at 168M. Save the file and refresh the Site Health page to confirm the new limits are active.
