WordPress Security ServicesMalware Removal
Site Down

"There Has Been a Critical Error on This Website": How to Fix It in WordPress

Your site shows one sentence: "There has been a critical error on this website." Sometimes with a link to "learn more about troubleshooting", sometimes not even that. It looks scary, but it's one of the most fixable WordPress problems. Here's how to find the cause and get the site back, and how to make sure it isn't malware.

Sergey By Sergey, WordPress security specialist Updated 2 min read
In this guide
  1. Step 1: Check your email for recovery mode
  2. Step 2: Find the error in the logs
  3. Step 3: Fix the cause
  4. Step 4: Rule out malware
  5. Prevent it next time

Step 1: Check your email for recovery mode

When a fatal error happens, WordPress emails the site’s admin address a message with a special recovery mode link. It lets you log in with the broken plugin or theme paused. The email usually says which plugin or theme caused the error. Log in, deactivate or update it, and you’re done.

Step 2: Find the error in the logs

No email? Turn on WordPress’s debug log. In wp-config.php, above the line that says That’s all, stop editing, add:

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

Reload the site, then open wp-content/debug.log. The last lines name the file and line that crashed, for example:

PHP Fatal error: Uncaught Error: Call to undefined function ... in /wp-content/plugins/some-plugin/includes/file.php:123

That path tells you exactly what’s broken. Your host’s PHP error log, in the control panel, shows the same information. Turn debugging off again afterwards.

Step 3: Fix the cause

The log points to… What to do
A plugin folder Rename that plugin’s folder (e.g. some-plugin to some-plugin-off) via SFTP or the file manager. WordPress deactivates it. Then update or replace it
Your theme Rename the theme folder. WordPress falls back to a default theme if one is installed. Then fix or update the theme
Memory exhausted Add define( 'WP_MEMORY_LIMIT', '256M' ); to wp-config.php, or ask your host to raise the PHP memory limit
A PHP version problem If the error started after your host upgraded PHP, update the plugin or theme, or temporarily switch back to the previous PHP version in your control panel
A core WordPress file Reinstall WordPress core: wp core download --version=$(wp core version) --skip-content --force, or upload fresh wp-admin and wp-includes folders

Step 4: Rule out malware

Check for malware if:

  • the error points to a file with a random name, or one that isn’t part of any plugin you installed;
  • the error mentions eval()'d code;
  • the site broke with no updates or changes on your side;
  • you also see unknown admins, redirects or strange files.

In those cases, the critical error is a symptom of a hack. See Is my WordPress site hacked? Fixing only the error would leave the infection in place.

From my cleanup work: a common case is a site that crashes overnight right after the host updates PHP. The log points to a file in wp-includes that turns out to be malware. It ran fine on the old PHP version and crashed on the new one. The critical error was the only reason anyone noticed the infection at all.

Prevent it next time

Update plugins and themes regularly, test big updates on a staging copy, keep off-site backups, and use uptime monitoring so you know before your visitors do. Or let the security care plan handle it.

Sergey, WordPress Security Specialist
About the author
Sergey, WordPress Security Specialist

10 years in WordPress security and incident investigation, and more than 200 websites cleaned of malware. Top Rated on Upwork with a 100% Job Success score. More about me

Frequently Asked Questions

What does the critical error mean?

PHP, the language WordPress runs on, hit a fatal error while building the page and stopped. Since WordPress 5.2, instead of a blank page, WordPress shows this message and emails the site administrator a recovery mode link.

I didn't get the recovery mode email. Why?

It's sent to the site's admin email address, which may be old, or the email may have been blocked or filtered as spam. Check spam folders. If it's not there, you'll need file access to find and fix the cause.

Can malware cause a critical error?

Yes. Badly written malicious code, a half-finished cleanup, or malware that breaks after a PHP update can all crash a site. If the error points to a file that isn't part of WordPress or your plugins, or appeared with no recent changes, check for malware.

Will fixing the error delete my content?

No. The cause is almost always in code (a plugin, theme or setting), not in your content. Your posts and pages are in the database and stay untouched.

Need a hand?

Let me clean your WordPress site for you

Send me your site URL and what you're seeing. I'll reply with what I think is going on and the next step.

$95 per infected site · 1-month guarantee · direct contact with the specialist

Get My Site Cleaned →