An open laptop on a wooden desk displaying lines of code, with a notebook beside it in a bright office.

How to fix “There has been a critical error on this website”

One grey line where your homepage should be. Your content is very likely still there. Here’s how to get the site loading again, one calm step at a time.

You open your website and see one line: “There has been a critical error on this website.” Take a breath. WordPress has stopped because one piece of code went wrong, and it has usually told you where to look.

The quickest fix is usually the recovery email WordPress sends to your site’s admin address. Its link lets you log in and switch off the plugin or theme that failed. No email? You can switch plugins off through your host’s file manager without logging in at all. This guide covers both, plus the white screen and “Briefly unavailable” messages that often come with them.

AdvertisementLooking after and fixing your website · Article topEnvato Elements – unlimited graphic assets

Key takeaways

  • Check the inbox of your site’s admin email address, including spam, for a message from WordPress with a recovery link.
  • No email, and you can’t access wp-admin? Rename the plugins folder in your host’s file manager, then try the theme folder.
  • Still stuck? Turn on the WordPress error log to find the real cause.
  • A blank white screen usually has the same causes and the same fixes.
  • Once it’s working, update one thing at a time, with a fresh copy of your site first.

What this message means

WordPress shows this message when it hits a “fatal error”, a problem serious enough that it can’t finish loading the page. The full message often adds: “Please check your site admin email inbox for instructions.”

WordPress’s own documentation lists the common causes:

  • a conflict between plugins
  • a theme that isn’t compatible
  • a PHP version your site’s code doesn’t support (PHP is the language WordPress runs on)
  • the site hitting its memory limit
  • damaged WordPress files

It very often appears straight after a plugin or theme update. If you’ve just done one, you already have your main suspect.

Start with the recovery email

Since version 5.2, WordPress has had a feature called Recovery Mode. When it detects a fatal error, it emails your site’s administrator address explaining what failed, with a special login link.

  1. Check the inbox for your site’s admin email address, and the spam folder.
  2. Open the email from WordPress and click the recovery link.
  3. Log in as normal. You’ll see a notice that you’re in Recovery Mode.
  4. Find the notice naming the plugin or theme that failed.
  5. Go to Plugins (or Appearance > Themes) and deactivate it.
  6. Click Exit Recovery Mode and check your site.

Recovery Mode only pauses the faulty plugin for your login session, so deactivating it is what actually gets the site loading again. Then look for an update from the plugin’s developer, ask in its WordPress.org support forum, or find an alternative. If you’d recently edited code, for example in a file called functions.php, put that change back too.

Can’t access wp-admin? Turn plugins off from your host’s file manager

The recovery email doesn’t always arrive. WordPress explains that if the error happens before an email plugin loads, the message is sent straight from your web server, and it can be filtered as spam or blocked.

You can still switch plugins off without logging in. You’ll need your host’s file manager, a tool in your hosting control panel that shows your site’s files in the browser, or a File Transfer Protocol (FTP) or SSH File Transfer Protocol (SFTP) program if you’re comfortable with one. Look for “File Manager” in your control panel, or search your host’s help pages.

Switch off all plugins

  1. Open your file manager and go to your site’s folder. It usually contains folders called wp-admin, wp-content and wp-includes.
  2. Open wp-content.
  3. Rename the plugins folder to plugins_old. This switches off every plugin at once without deleting anything.
  4. Reload your website.

If the site now loads, a plugin was the cause. Rename plugins_old back to plugins. Your plugins will show as deactivated. Log in and reactivate them one at a time, reloading after each, until the error returns. That’s your culprit.

If you already know which plugin it is, rename only its folder inside wp-content/plugins.

Then try the theme

If plugins weren’t the problem, go to wp-content/themes and rename your active theme’s folder. WordPress will then try to use a default theme, so make sure one of the default “Twenty” themes is still installed. Your site will look different for now, but your content is untouched.

Find the real error

If you’re still stuck, WordPress can write errors to a log file. This needs one small edit to wp-config.php, in your site’s main folder.

  1. Make a copy of wp-config.php first, by downloading or duplicating it.
  2. Open it and find the line that begins /* That's all, stop editing!
  3. Just above that line, add these lines from the WordPress debugging guide:

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

If any of these lines already exist, change them rather than adding them twice.

  1. Save the file and reload your site.
  2. Open wp-content/debug.log and look at the most recent “Fatal error” line. Its file path usually names the plugin or theme, for example wp-content/plugins/plugin-name/.

The last two lines keep errors in the log and off your public pages. When you’ve finished, set WP_DEBUG back to false or remove the lines.

Your host may keep its own error log in the control panel. If you can’t edit wp-config.php, look there or ask your host’s support team what the latest error says.

WordPress white screen of death fix

Sometimes there’s no message at all, just a blank white page, nicknamed the “white screen of death”. WordPress says both PHP errors and database errors can cause it, and the usual suspects are the same: a plugin, the theme or the memory limit. The fix is the same too: rename the plugins folder, then the theme folder, then check the error log.

If the log says “Allowed memory size exhausted”, your site has run out of memory. WordPress suggests raising the limit. On shared hosting, your host may need to do that for you.

After a PHP change or a plugin update

After a plugin or theme update: switch that one plugin off using the steps above. Then check its WordPress.org page for a newer version or a support thread about the same error.

After a PHP version change: hosts upgrade PHP from time to time, and older plugins and themes sometimes can’t cope. Most hosting control panels let you choose your PHP version. Switching back can get you online while you update or replace whatever isn’t compatible. Treat it as a short-term fix.

Stuck on “Briefly unavailable for scheduled maintenance”

During an update, WordPress creates a hidden file called .maintenance in your site’s main folder and removes it once the update finishes. If the update is interrupted, the file and the message can stay behind.

  1. Wait a few minutes in case an update is still running.
  2. In your file manager, go to the folder that contains wp-config.php.
  3. Turn on “show hidden files” if you need to, and find .maintenance.
  4. Delete it and reload your site.
  5. Log in, check Dashboard > Updates and rerun anything that didn’t finish.

FAQ

Will I lose my content? Usually not. Posts and pages live in the database, and these fixes only switch off code. If you have a copy of your site you made earlier, restoring it is another way back. WordPress’s backup guide says to restore the files first, then the database. Anything added since the copy was made may be lost.

Can I just delete the broken plugin? You can, but renaming its folder is safer. You keep its settings in case the developer releases a fix.

How do I stop it happening again? Make a copy of your site before updates, and update one thing at a time, checking the site after each. Delete plugins you don’t use, too.

What to do now

Start with the admin inbox and the recovery email. If it isn’t there, open your host’s file manager and rename the plugins folder. Once the site is back, make a note of what caused it, and put “copy first, update one at a time” into your routine.

Sources

  • WordPress.org, “Recovery Mode”: https://wordpress.org/documentation/article/recovery-mode/
  • WordPress Developer Resources, “Common WordPress errors”: https://developer.wordpress.org/advanced-administration/wordpress/common-errors/
  • WordPress Developer Resources, “Debugging in WordPress”: https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/
  • WordPress.org, “Updating WordPress”: https://wordpress.org/documentation/article/updating-wordpress/
  • WordPress Developer Resources, “WordPress Backups”: https://developer.wordpress.org/advanced-administration/security/backup/

Photo: Daniil Komov on Pexels

AdvertisementLooking after and fixing your website · Article bottomAdvertise here