How to fix "There has been a critical error on this website" in WordPress
WordPress shows this message in place of any page that PHP could not finish. It is the same whatever failed. The real error is one line, kept in an email to the site's administrator, in the debug log and in the server's log. Find that line first. It says which fix you need.
- By
- WP Ministry
- Published
- Tested on
- WordPress 7.1.3, PHP 8.3.35
In short
- The message is the same for every fatal PHP error. The real error is one line that WordPress keeps off the page.
- Nothing is lost. Your posts, pages, settings and uploads are untouched.
- Open your login page. WordPress emails a recovery link only when the error shows there or in the dashboard.
- The email, the debug log and the host's error log each hold the real error. One of them is enough.
- What that line says decides the fix. It may be memory, time, a syntax error, or one plugin or theme to switch off.
- Renaming one plugin's folder switches that plugin off without the dashboard, and keeps its settings.
"There has been a critical error on this website." is what WordPress shows in place of a page when PHP, the language it runs on, stops with an error it cannot recover from. WordPress has caught such errors since version 5.2, which worded the message "The site is experiencing technical difficulties." The sentence is the same whatever failed. The real error is one line of text, and WordPress keeps it off the page.
Nothing has been lost. Your posts, pages, settings and uploads are where they were. Find that one line and you know which fix applies.
What the message tells you
The wording depends on where you read it.
- On a public page: the one sentence and a link, "Learn more about troubleshooting WordPress." The link leads to general troubleshooting questions, not to anything about your site.
- On the login page or in the dashboard: the same sentence, then "Please check your site admin email inbox for instructions." Recovery mode is running, and it emails a link when the failing file belongs to a plugin or a theme.
- On the login page, with no mention of email: WordPress failed before recovery mode had started, as it does when the failing file is a must-use plugin. No email is coming. Go to the second fix.
What the line says, and where the fix is
| The line says | What happened | Where the fix is |
|---|---|---|
Allowed memory size of … bytes exhausted | The page asked for more memory than PHP allows. | How to fix "Allowed memory size exhausted" |
Maximum execution time of … seconds exceeded | The page ran for longer than PHP allows. | How to fix "Maximum execution time exceeded" |
PHP Parse error, or E_PARSE in the email | PHP could not read a file as code. | How to fix "Parse error: syntax error, unexpected" |
Call to undefined function … or Class "…" not found | The code called something that is not there. | The PHP version fix below, if it began when the PHP version changed. Otherwise switch off the plugin or theme in the path. |
Cannot redeclare … | Two files define a function under one name, which PHP does not allow. The line names both. | Switch one of the two off, then see how to find and fix a plugin conflict. |
Failed opening required … | A file the code needs is missing, as an update that did not finish can leave it. | A WordPress update went wrong: a runbook |
| Anything else | The plugin or theme in the path failed. | Switch it off, as below. |
A path through wp-content/plugins/ followed by a folder name is that plugin, and one through wp-content/themes/ is that theme. If the path is inside wp-includes or wp-admin, read down the lines under Stack trace: for the first path through wp-content. That code made the call that failed.
Where it goes wrong
A page request passes through each of these in turn. This one comes from PHP, the language WordPress runs on.
- Browser
- DNS
- HTTPS
- CDN or firewall
- Web server
- PHP (this error comes from here)
- WordPress
- Database and files
What causes it
A plugin stopped with a fatal error
CommonA plugin was updated to a version with a fault, calls code from another plugin that is no longer there, or clashes with a second plugin.
Fix: Use the recovery link WordPress emails you, or Find the error behind the message, or Switch the failing plugin or theme off from outside, or Undo the last change
The theme stopped with a fatal error
CommonA theme update brought a fault with it, or code pasted into the theme's functions.php has a mistake in it.
Fix: Use the recovery link WordPress emails you, or Find the error behind the message, or Switch the failing plugin or theme off from outside, or Undo the last change
The code and the server's PHP version do not match
SometimesA new PHP version can remove old features. Code that still uses one fails when the host moves the site to that version, and code written for a newer PHP can fail on an older one.
Fix: Find the error behind the message, or Match the PHP version to the code
A page ran out of memory or time
SometimesPHP stops a page that asks for more memory, or runs for longer, than the server allows. WordPress shows the same message for both.
WordPress's own files are damaged or incomplete
RareAn update that did not finish can leave a file missing or half written, and the code that needs it then fails.
Fix: Find the error behind the message, or Undo the last change
How to fix it
Use the recovery link WordPress emails you
- Easy
- No risk
- About 10 minutes
- Steps tested on WordPress 7.1.3
Step 1: Open your login page
Go to
https://example.com/wp-login.php, with your own domain. WordPress sends the email only when the error shows on the login page or in the dashboard, never for a public page.Step 2: Find the email
Its subject ends "Your Site is Experiencing a Technical Issue". It goes to the site's administrator address, so check that inbox and its spam folder. It names the plugin or theme that failed, and ends with a section headed "Error Details".
Step 3: Follow the link and log in
The dashboard loads with a notice that begins "You are in recovery mode." The plugin or theme that failed is paused for you alone. Visitors still see the error.
Step 4: Deactivate what failed
On the Plugins screen, the plugin carries the note "This plugin failed to load properly and is paused during recovery mode." Select Deactivate under its name. If the email named the theme, go to Appearance, then Themes, and activate another.
Step 5: Leave recovery mode
Select "Exit Recovery Mode" in the toolbar, then load the site in a private window. It loads for everyone.
No email? By default WordPress sends one a day, and does not try again within that day even when the first could not be sent. How to deactivate WordPress plugins when you are locked out of the dashboard lists the other reasons. The next two fixes need no email.
To undo it: Activate the plugin or theme again once it is fixed.
Find the error behind the message
- Takes care
- Low risk
- About 15 minutes
- Steps tested on WordPress 7.1.3
The real error is written down in up to three places. One is enough.
- The email. Its "Error Details" section is the error.
- The host's error log. PHP has a log of its own, set by the server. Look for it in your hosting panel, or ask the host what PHP reported at the time of the fault.
- WordPress's debug log. If you have neither, switch it on as follows.
Step 1: Turn the debug log on
In
wp-config.php, find the linedefine( 'WP_DEBUG', false );and replace it with these three, above the line that says "stop editing". They write errors to a file and keep them off the page.wp-config.phpdefine( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false );Step 2: Load the page that shows the message
Once is enough.
Step 3: Read the newest fatal line
Open
wp-content/debug.logand find the newest line that begins "PHP Fatal error" or "PHP Parse error". Over SSH, from the folder that holdswp-config.php, this prints the last three:bashgrep -E "PHP (Fatal|Parse) error" wp-content/debug.log | tail -n 3Step 4: Turn the debug log off
Set
WP_DEBUGback tofalseand deletedebug.log. How to turn on WordPress debug mode covers the rest: reading a line part by part, and keeping the log out of public view.
You can also paste the line into the WordPress error message and debug.log decoder. It shows what each line means, which plugin or theme it points at, and what to do first. It reads the lines in your browser, and nothing is sent.
To undo it: Set WP_DEBUG back to false and delete debug.log.
Switch the failing plugin or theme off from outside
- Takes care
- Low risk
- About 10 minutes
- Steps tested on WordPress 7.1.3
This brings the site back while the plugin or theme is being fixed. A plugin switched off this way keeps its settings.
Step 1: Rename the plugin's folder
In your host's file manager or over SFTP, open
wp-content/pluginsand add-offto the name of the folder the error named. Over SSH, from the folder that holdswp-config.php:bashmv wp-content/plugins/plugin-folder-name wp-content/plugins/plugin-folder-name-offStep 2: Reload the site
It loads without that plugin. WordPress skips an active plugin whose file is not where it expects it.
Step 3: Log in and open the Plugins screen
Do this before you rename the folder back. WordPress finds the plugin's file gone there and records the plugin as deactivated. Until then it is only missing: put the folder back sooner and the plugin runs again, fault and all.
With WP-CLI there is nothing to rename. The two extra options keep WP-CLI from loading the broken code while it runs:
wp plugin deactivate plugin-folder-name --skip-plugins --skip-themesIf the path named the theme, activate another installed theme by its folder's name:
wp theme activate other-theme-folder-name --skip-plugins --skip-themesThe guide to deactivating plugins when you are locked out has the full method: every plugin at once, a theme without WP-CLI, must-use plugins and the database.
To undo it: Rename the folder back, then activate the plugin on the Plugins screen.
Undo the last change
- Takes care
- Back up first
- About 30 minutes
If the message appeared straight after a change, that change is the first suspect.
Step 1: If it began with an update
Follow the runbook for an update that went wrong. It switches the updated plugin off, then chooses between going back one version and restoring the backup.
Step 2: If it began with code you pasted or a file you edited
Take the new code out, or upload the file as it was. How to fix "Parse error: syntax error, unexpected" shows how while the dashboard is down.
Match the PHP version to the code
- Takes care
- Back up first
- About 20 minutes
Suspect this when the PHP version has just changed at the host. A new PHP version can remove old features, and code that still uses one stops. Call to undefined function create_function() is an example: PHP 8.0 removed that function. Code written for a newer PHP can fail on an older one, too.
Step 1: Find the PHP version the site runs
The recovery email gives it, on a line that begins "PHP version". Otherwise look in your hosting panel, where the version is set.
Step 2: Find the version the code needs
A plugin can state the lowest PHP version it supports on a
Requires PHPline at the top of its main file.Step 3: Update the plugin or theme first
A version written for your PHP may already be out. Once the plugin is deactivated and its folder has its own name again, update it from the dashboard.
Step 4: Or change the PHP version for now
Take a backup. Then set the version in your hosting panel to the one the site last worked on, or ask your host to. Treat that as temporary. The WordPress and PHP end-of-life checker shows whether your PHP and WordPress versions still get security fixes, and until when.
To undo it: Set the PHP version back in your hosting panel.
When to get help
Stop when the line in the log points at WordPress's own files and not at a plugin or the theme, when the site still fails with every plugin off and a default theme active, or when you can reach neither the files nor a log. On a store, stop sooner. Orders are being lost while you test.
Common questions
Why does the message not say what went wrong?
WordPress shows visitors one sentence for every fatal error. The details go to the administrator by email and to the error log. PHP's manual advises the same for any live site: log errors, do not display them.
Is this the same as the white screen of death?
It is the same failure, a fatal PHP error. A public page can still come out blank or cut off partway, because there WordPress shows the message only if nothing of the page had been sent when the error struck. How to fix the WordPress white screen of death starts from that blank page.
The message shows on one page only. Is that the same thing?
Yes. Each page runs different code, so a fault in one plugin's feature shows only where that feature runs. Turn the debug log on, load that page, and read the line it writes.
- GuideLocked out of WordPress admin: find which lockout you have and get back in
- GuideSlow WordPress admin: how to find the cause and fix it
- ResourceWooCommerce checkout is down: a runbook
- GuideWordPress site not showing up on Google: what to check, in order
- Guideadmin-ajax.php high CPU usage in WordPress: how to find what is calling it
- GuideHow to change WordPress permalinks without breaking your old links

