In this guide
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.