WordPress critical error: fix it in 15 minutes without losing data

“There has been a critical error on this website.” It is the WordPress critical error, and it usually appears right after an update. It looks like the whole site is gone. It almost never is: your posts, pages and orders are still in the database. Something in the code just stopped PHP mid-page. This guide shows how to fix a WordPress critical error safely, usually in about 15 minutes, without touching your content.

WordPress critical error message before and after the fix

What causes a WordPress critical error

Nine times out of ten it is a plugin or theme update that does not agree with your PHP version or with another plugin. The usual suspects:

  • A plugin or theme update that needs a newer PHP version.
  • Two plugins that load the same code library in different versions.
  • PHP running out of memory on a heavy page.
  • An update that timed out halfway, leaving files from two versions.
  • A hacked or modified file.

The steps below find out which one in minutes.

Before you start: take a backup

Even a broken site can be backed up. Download the wp-content folder over FTP or your host’s file manager, and export the database from phpMyAdmin or your hosting panel. Most hosts also keep daily backups you can restore with one click. With a backup in hand, nothing below can make things worse.

Step 1: check your email

WordPress sends the admin email a message with a recovery mode link and, often, the name of the plugin that failed. Open that link and you can log in with the broken plugin paused. The link only works for a limited time, so use it soon.

Step 2: turn on the error log

If there is no email, add these lines to wp-config.php just above “That’s all, stop editing”. The real error is then written to wp-content/debug.log instead of shown to visitors. The official WordPress debugging guide explains each setting in more detail.

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

No FTP access? Use your hosting panel

You do not need FTP software for any of this. cPanel, Plesk and most managed hosts have a file manager in the browser where you can edit wp-config.php and rename plugin folders. Many managed WordPress hosts also have a plugins screen of their own that works even when the site is down. If your host gives you SSH, WP-CLI can switch every plugin off in one command, and you can then turn them back on one at a time to find the culprit.

wp plugin deactivate --all
wp plugin activate plugin-name

Step 3: find the culprit

The last lines of debug.log name a file. If the path contains wp-content/plugins/something, that plugin is the cause. Rename its folder over FTP or in your host’s file manager and the site comes back. If the path points at wp-content/themes, it is your theme. If it points at wp-includes or wp-admin, a core update probably failed, and reinstalling WordPress from Dashboard, Updates usually fixes it.

Step 4: fix it properly

  • Update the plugin, or roll back to the last version that worked.
  • Check the PHP version: plugins written for PHP 7 often fail on PHP 8.
  • If it is your theme, switch to a default theme for a moment to confirm.
  • Turn WP_DEBUG back off when you are done.

Take a full backup before you change anything. A five minute backup turns any mistake into an undo.

Common WordPress critical error messages, decoded

The line in debug.log usually starts with “PHP Fatal error” followed by one of these. Each points at a different fix:

  • Allowed memory size exhausted: PHP ran out of memory. Raise the memory limit, then find out which plugin needs so much.
  • Call to undefined function: a plugin expects another plugin, or a newer PHP version, that is not there.
  • Cannot redeclare: two plugins, or a plugin and your theme, define the same function. Remove one.
  • Maximum execution time exceeded: something took too long, often an import, a backup or a slow external request.
  • Syntax error, unexpected: a file was edited by hand and has a typo, very often the theme’s functions.php.

WordPress white screen with no message

Older WordPress versions, and some hosts, show a blank WordPress white screen instead of the critical error message. It is the same problem wearing a different face. Follow the same steps: the error log will name the file. If the log stays empty, raise the PHP memory limit by adding define( ‘WP_MEMORY_LIMIT’, ‘256M’ ); to wp-config.php, then reload the page.

How to stop a WordPress critical error happening again

Most critical errors come from updating on the live site. Update on a staging copy first, keep daily off-site backups, and remove plugins you no longer use. If the error keeps coming back, or the site was hacked rather than broken, get a developer to diagnose it: most fixes take under an hour once the cause is known.

Fixes start from $79 on the services page, or send the error message and get a reply within a day. Site working but crawling? Read why your WordPress site is slow.

Ahsan Salman

Full-stack web developer. Builds, fixes and looks after websites, web apps and online stores for businesses and agencies.

Start a project

Tell me a little about it. You'll get a reply within one working day.