Planning to sell this domain/site, Want to buy it? Make an offer!

How to Fix “There Has Been a Critical Error on This Website” in WordPress

The "critical error" message hides a PHP fatal error. Here's how to use recovery mode and the debug log to find the plugin, theme or setting that caused it, and fix it.

You update a plugin, refresh the page, and instead of your site you get one line of grey text: “There has been a critical error on this website.” Sometimes it adds “Please check your site admin email inbox for instructions.” The admin area may be gone too, which is what makes this error feel worse than it usually is.

The message means PHP hit a fatal error and WordPress caught it before the visitor saw a stack trace. Your content is almost always fine. The job is to find which file threw the error, and that takes a few minutes once you know where to look.

What the message means

Since WordPress 5.2, core has shipped with fatal error protection. When a plugin or theme crashes PHP, WordPress shows this generic message instead of a white screen, and it emails the site’s admin address a special login link. That link opens recovery mode, a session where the broken plugin or theme is paused just for you, so you can log in and deal with it.

So before you touch anything else, check the inbox of the address set under Settings > General. Look in spam as well. The subject line usually reads something like “Your Site is Experiencing a Technical Issue”, and the body names the plugin or theme that failed along with the file and line number.

If that email arrived, you are already most of the way there. Click the recovery link, log in, and WordPress will show a notice pointing at the extension that caused the crash. Deactivate it, then decide whether to roll back to the previous version, wait for a fix, or replace it.

When the recovery email never shows up

On a lot of sites the email simply never arrives. The admin address may belong to someone who left years ago, or the server may not send mail reliably. In that case you need to read the error yourself.

Turn on the debug log

Open wp-config.php over SFTP or your hosting file manager and find the line that says /* That's all, stop editing! */. Just above it, add or adjust these constants:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

This writes errors to wp-content/debug.log without printing them on the page for visitors. Reload the broken page once, then open debug.log. Scroll to the bottom and look for a line that starts with PHP Fatal error.

A typical entry looks like this:

PHP Fatal error:  Uncaught Error: Call to undefined function some_old_helper()
in /home/site/public_html/wp-content/plugins/example-plugin/includes/class-loader.php:84

The path is the useful part. Anything under wp-content/plugins/example-plugin/ points to that plugin. Anything under wp-content/themes/ points to your theme or child theme. A path inside wp-includes or wp-admin is rarer and usually means a plugin passed something unexpected into core, or that core files were only partly updated.

Your host’s own PHP error log is worth checking too. On most control panels it sits under a section called Logs or Error Logs, and it catches errors that happen before WordPress has loaded enough to write its own log.

Remember to set WP_DEBUG back to false once you’re done, and delete the log file. Debug logs can contain file paths and query details you don’t want sitting in a public folder.

The usual causes, and how to fix each one

A plugin update that went wrong

Plugin updates cause this error more often than anything else. The fix is to switch that plugin off without needing the dashboard. Using SFTP or the file manager, go to wp-content/plugins/ and rename the plugin’s folder, for example from example-plugin to example-plugin-off. WordPress can no longer find it, so it deactivates it on the next page load.

If you can’t tell which plugin is responsible, rename the whole plugins folder to plugins-off. Once the site loads, rename it back, then reactivate plugins one at a time from the dashboard until the error returns. If you only have database access, the same thing can be done through phpMyAdmin, as described in this older guide on deactivating all plugins via the database.

With WP-CLI on the server it’s quicker still:

wp plugin deactivate example-plugin --skip-plugins --skip-themes
# or, if you're not sure which one it is
wp plugin deactivate --all --skip-plugins --skip-themes

Without the --skip-plugins --skip-themes flags, WP-CLI loads the same broken code and crashes with the same error.

The theme, or a snippet in functions.php

Code pasted into functions.php is the second big culprit, especially snippets copied from forums that are missing a closing bracket or that call a function a plugin no longer provides. If the log points at your theme, either fix the line it names or rename the active theme’s folder. WordPress will fall back to a default theme if one is installed, which is a good reason to keep one of the official Twenty-something themes on every site even if you never use it.

A PHP version change

If nobody updated anything but the error appeared overnight, check whether your host moved the site to a newer PHP version. Old plugins that call removed functions, such as create_function() or each(), fail outright on PHP 8. The log will name the function. You can temporarily switch PHP back in your hosting panel to get the site online, then replace or update the extension that can’t cope.

Running out of memory

Look for “Allowed memory size of … bytes exhausted” in the log. That is a different problem with the same symptom, and it usually happens during imports, image processing or with heavy page builders. You can raise the limit in wp-config.php:

define( 'WP_MEMORY_LIMIT', '256M' );

Your host’s PHP limit still caps this, so if the value doesn’t take effect, raise it in the PHP settings of your control panel as well. There’s an older walkthrough of the classic version of this error in Allowed memory size fatal error in WordPress. The cause is the same today even though the default numbers have grown.

A half-finished core update

If an update timed out, you might see a stuck maintenance notice first (deleting the .maintenance file in the site root clears it, as covered in removing the “Briefly unavailable” message). Missing or mismatched core files are a different story. Re-upload fresh copies of wp-admin and wp-includes from the same WordPress version, or run:

wp core verify-checksums --skip-plugins --skip-themes
wp core download --force --skip-content --version=$(wp core version --skip-plugins --skip-themes)

The first command lists any core files that differ from the official release. The second replaces core files with clean copies of the version you already run, and it leaves wp-content and wp-config.php alone.

Make the next one easier to fix

A few habits make this error much quicker to deal with next time:

  • Keep the admin email current. If the person who maintains the site should get recovery links, you can also define RECOVERY_MODE_EMAIL in wp-config.php with their address.
  • Make sure the site can send email, or the recovery link never arrives.
  • Update plugins in small batches rather than all at once, so that when something breaks you already know which handful of plugins to suspect.
  • Take a backup before updates and keep a staging copy for anything that touches checkout, membership or forms.

The official WordPress documentation on debugging in WordPress covers every debug constant in detail if you want to go further.

If you’ve followed the log and the site still won’t come back, or the error points somewhere you’d rather not edit on a live site, that’s the kind of problem I help with as a WordPress developer. Send the relevant lines from your debug log through the contact page and I’ll take a look.

You May Also Like This :