The full message reads something like "Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 20480 bytes) in /home/.../wp-content/plugins/... on line 412". PHP, the language WordPress runs in, gives each page load a memory allowance, and this page load ran out of it. Visitors usually do not see that line: since WordPress 5.2 they see "There has been a critical error on this website", and the real message goes to the error log and to the admin email address. The message holds three clues: the allowance, the size of the last request, and the file that asked. Below is a rebuilt example (not a real client), then how to read those clues and what to change.
error_log sits in the site's folder.wp-content/plugins/name/ is that plugin, wp-content/themes/name/ is the theme. A path in wp-includes is WordPress itself doing the work some plugin or a large image asked for, so look at what was happening rather than blaming WordPress.WP_MEMORY_LIMIT). If you cannot log in, use the recovery link from the email.wp-config.php and any .user.ini or php.ini in the site folder before editing them.memory_limit to 256M. Other hosts have a "PHP settings" page with the same field. This is the setting everything else depends on.wp-config.php, above the line that says /* That's all, stop editing! */, add define( 'WP_MEMORY_LIMIT', '256M' );.user.ini in the site's main folder with the line memory_limit = 256M works on most hosts; it can take a few minutes to apply. Only put a php_value line in .htaccess if the host's help pages say so, because on many servers that line itself takes the whole site down with a 500 error.wp-content/plugins in the file manager, which keeps its settings) and check the site. Then look for the plugin's known issue or a replacement. The plugin conflict guide has the one-at-a-time method when the path is not clear.WP_MAX_MEMORY_LIMIT, 256 MB by default). It can only reach that if the host lets it, so the host's memory_limit from step 2 is still the one to check.| What you find | What it means | Usual fix |
|---|---|---|
| Allowance 64 MB or 40 MB, small "tried to allocate" | The allowance is too small for the site | memory_limit 256M in the host panel, WP_MEMORY_LIMIT 256M in wp-config.php |
| "tried to allocate" in the tens or hundreds of millions | One plugin, theme or file asked for a giant block: a bug or a loop | Update or switch off what the path names; raising the limit will not stop it |
| Still runs out at 256 MB or 512 MB | Something keeps using memory until any limit is gone | Same as above: find the plugin, do not keep raising the number |
| Only when uploading photos | Very large photos being resized | Resize to about 2000 pixels before uploading |
| Site Health still shows the old limit after the change | The host's setting wins, or the plan caps it | Change it in the host panel, or ask support |
| Started right after a plugin or theme update | The new version uses more memory or has a bug | Roll back or switch it off, tell its author |
-1 (unlimited) or to 1024M and walk away. A plugin with a loop will then use the whole server's memory, and on shared hosting the host stops or suspends the account instead of showing an error.php_value memory_limit line into .htaccess unless the host says it is supported: on many servers it turns one broken page into a site-wide 500 error.define line at the very bottom of wp-config.php. Below "That's all, stop editing!" it is read too late and does nothing.Most sites need step 2 and are back in ten minutes; the rest need the plugin the message names updated or replaced. If the site is still showing the error, or the host will not raise the limit, that is what the box below is for. Related: "there has been a critical error" is how this error looks from the front of the site, and the white screen guide covers the same failure when nothing at all is shown.