BlogWebsite Maintenance
"There Has Been a Critical Error on This Website": How to Fix It
Rustam8 min read
"There has been a critical error on this website" means WordPress hit a PHP fatal error and stopped loading the page. The cause is almost always a plugin, the theme, or a PHP version change on your hosting. To fix it, check the site admin email inbox for WordPress's recovery mode link, or turn on the debug log to see which file caused the error, then disable that plugin or theme (by renaming its folder over SFTP or your host's file manager if you can't reach wp-admin). Once the site loads, update or replace the faulty code and test on staging before trying again.
I'm Rustam from Frame the Pixel, a WordPress maintenance studio in Kuala Lumpur. This is one of the most common emergencies I'm asked to fix, and it's usually quicker to sort out than it looks. Here's the order I work in.
What the critical error actually means
Since WordPress 5.2, instead of a blank white page, WordPress catches fatal PHP errors and shows this friendly message. The feature is called fatal error recovery mode. Behind the message is a real PHP error with a file name and line number. Your job is to find that line.
Common causes:
- A plugin or theme update that conflicts with another plugin, or needs a newer PHP version.
- Your host upgraded PHP and an old plugin or theme uses code the new version no longer allows.
- A partial or failed update left files half written.
- A custom code snippet added to
functions.phpwith a typo. - Running out of PHP memory.
- Occasionally, malware that has damaged files.
If the screen is completely blank with no message at all, that's the related white screen of death, and most of the same steps apply.
Before you start: two quick safety steps
- Take a backup if you can, from your host's control panel. Even a broken site should be backed up before you change files.
- Write down what changed recently. An update, a new plugin, a host email about PHP. That's usually your answer.
Step 1: Check your email for the recovery mode link
When the error happens, WordPress tries to email the site's admin email address with the subject along the lines of "Your Site is Experiencing a Technical Issue". The email names the plugin or theme that caused the error and includes a special link.
- Click the link. It logs you into wp-admin in recovery mode, with the faulty plugin or theme paused.
- Go to Plugins (or Appearance, Themes), and deactivate or update the one named.
- Exit recovery mode and check the site.
If you don't get the email, check spam, and check which address is set as the admin email. On many sites it's an old developer's address, which is one more reason to keep it current. If the email never arrives, move to Step 2.
Step 2: Turn on the debug log
If there's no email, the debug log tells you exactly what failed. You need access to your files through your host's file manager or SFTP.
- Open
wp-config.phpin the site's root folder. - Above the line that says "That's all, stop editing!", add or change these lines:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
- Reload the broken page once.
- Open
wp-content/debug.log. Look for a line starting "PHP Fatal error". It names the file, usually insidewp-content/plugins/plugin-name/orwp-content/themes/theme-name/.
WordPress's debugging documentation explains these settings. Turn debug off again when you're done, as the log can fill up and may expose details about your site.
Your host's PHP error log, usually in the control panel, shows the same information if you'd rather not edit wp-config.php.
Step 3: Disable the plugin or theme causing it
Once you know the culprit, disable it.
If you can reach wp-admin: deactivate the plugin in Plugins.
If you can't reach wp-admin:
- Using the file manager or SFTP, go to
wp-content/plugins/and rename the plugin's folder, for example fromplugin-nametoplugin-name-off. WordPress will deactivate it. - If you have WP-CLI on your host,
wp plugin deactivate plugin-namedoes the same. See the WP-CLI documentation. - If the log points to the theme, rename the theme's folder. WordPress will fall back to a default theme if one is installed. The site will look different, but it'll load.
If you can't tell which plugin it is: rename the whole plugins folder to plugins-off. If the site comes back, rename it back to plugins, then rename plugin folders one at a time until the error returns.
Step 4: Fix the cause, not just the symptom
Getting the site loading is half the job. Now:
- If a plugin update caused it, check the plugin's changelog and support forum. Often a fix follows within days. Roll back to the previous version in the meantime, or wait for the fix. My post on what to do when a WordPress update broke your site covers rollbacks in more detail.
- If a PHP upgrade caused it, check the plugin or theme supports your PHP version. If it's abandoned and doesn't, replace it. Moving back to old PHP is only a stopgap, as old versions lose security support. PHP.net lists the currently supported versions and WordPress publishes its recommended requirements.
- If memory is the issue (the log says "Allowed memory size exhausted"), ask your host to raise the PHP memory limit, and find out what's using so much.
- If it was a code snippet, remove or correct it. Use a snippets plugin next time rather than editing
functions.phpdirectly. - If files look tampered with, treat it as a possible hack. See what to do in the first hour after a WordPress hack.
Step 5: Check the rest of the site
When it loads again, check more than the home page:
- Log in and visit the dashboard.
- Submit your contact form and check the email arrives.
- If you run a shop, place a test order. See WooCommerce maintenance for what to check.
- Look at Tools, Site Health. WordPress's Site Health screen flags PHP version, failed updates and other issues.
When it's not a plugin or the theme
Every so often, disabling all plugins and switching theme doesn't help. Then I look at:
- WordPress core files. A failed core update can leave files missing. Re-uploading fresh copies of the
wp-adminandwp-includesfolders from WordPress.org, without touchingwp-contentorwp-config.php, fixes it. - The
.htaccessfile. A corrupted one usually gives a server error rather than the critical error, but it's worth renaming to rule out. WordPress recreates it when you save Settings, Permalinks. - Must-use plugins. Files in
wp-content/mu-pluginsload automatically and don't appear in the normal plugin list. Hosts and some security tools put code there. - Drop-ins such as
object-cache.phporadvanced-cache.phpinwp-content, left behind by a caching plugin that was removed. - The server itself. If PHP extensions are missing after a host change, the log will usually name the missing function. Your host can enable it.
Critical error only in wp-admin?
Sometimes the front of the site works and only the admin shows the error. The cause is still usually a plugin, often one that adds a dashboard widget or admin page. The same debug log steps apply.
How to stop it happening again
- Test updates on a staging copy before running them on the live site.
- Keep daily off-site backups so you can restore quickly.
- Check plugins support the PHP version before your host upgrades it. Hosts usually email in advance.
- Remove plugins and themes you don't use, especially abandoned ones.
- Keep the admin email address current so the recovery email reaches you.
My WordPress maintenance checklist builds these into a routine, and WordPress care plan features explains what to expect if you hand it over.
Still stuck?
If the site is down and you'd rather someone else fixed it, I do this as part of my website maintenance service. I'll find the error, get the site loading, fix the cause and set up testing so it doesn't catch you out again. I'm available 9am to 5pm Malaysia time (GMT+8) and work with clients in Malaysia, the UK, Europe and elsewhere. Contact me or email contact@framethepixel.com.
FAQ
What causes "There has been a critical error on this website"?
A PHP fatal error, usually from a plugin or theme conflict, an update, or a PHP version change on the host. The debug log or the recovery email tells you which.
How do I fix a WordPress critical error without wp-admin access?
Use your host's file manager or SFTP to rename the faulty plugin's folder in wp-content/plugins. If you don't know which plugin, rename the whole plugins folder, then restore and test one at a time.
I didn't get the recovery mode email. Why?
The admin email may be out of date, the email may be in spam, or your site may not be able to send email. Use the debug log instead.
Can a PHP update cause a critical error?
Yes. Newer PHP versions remove old functions, and outdated plugins or themes that rely on them fail. Update or replace the plugin rather than staying on old PHP.
Will I lose my content?
Almost never. Your posts, pages and settings are in the database and aren't affected by a fatal error. Fixing the error brings the site back as it was.