How to fix the WordPress error “there has been a critical error on your website”

It’s likely at some point in your journey with WordPress, that you’ll come across the following error

There has been a critical error on your website. Please check your site admin email inbox for instructions. Learn more about debugging in WordPress.

I know – terrifying. But don’t worry! Your site is not lost and it can be fixed.

First thing you should do is check your admin email address for the email from WordPress, as that should give you more details about the error and allow you to access your site in recovery mode.

If you haven’t received the email or don’t know how to resolve the error, here is a guide to useful steps you can work through to fix this problem.

Remember to backup your full site regularly and before making any changes to the code.

1. Identify what you were doing before this error happened

There are quite a few reasons you may experience this error in WordPress, so try to remember what was your last action was.

  • Did you install or delete a plugin?
  • Did you activate or deactivate a plugin?
  • Did you upload, activate or deactivate a new theme?
  • Did you make any changes to your web hosting?
  • Did you update anything through FTP?
  • Did you update your PHP version?

And if so, can you undo it? If you noticed this error after making a chance to your site, try reversing the change.

2. Check logs

Login to your site using FTP and check the error logs. If that doesn’t help, try enabling debug mode. To do this login to your site using FTP and open the wp-config.php file from WordPress root folder in a text editor. Find the following lines

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

Change the false values to true and save. Now when you refresh your site, you may see other errors that may give you a better understanding of where the error is coming from. You can also check the debug logs via FTP. Make sure to turn these back to false once you’re done. For more details on debugging in WordPress, visit the debug support page. If it’s possible to get onto the backend of your site you could also check the health tool.

3. Rule out a theme conflict

You should deactivate your current theme temporarily and instead activate a default WordPress theme, like Twenty Nineteen or Twenty Twenty.

To do this, login to your site using FTP. Find your current theme with the wp-content folder (wp-content > theme > theme-name).

Rename your active theme’s folder by adding something to the end of the folder’s name (like changing theme-name to theme-name-disabled)

Once you’ve done that refresh your site. If you are still seeing the same error message, then you know it is not a theme conflict. Remember to change back the folder name once you’re done.

3. Rule out a plugin conflict

If it’s not the theme, it might be a plugin issue. You can either do exactly the same as above for separate plugins to disable individual plugins or disable all plugins altogether, which is what I recommend.

Login to your site using FTP and find the plugin folder within the wp-content folder (wp-content > plugins).

To disable all plugins all once, add something to the end of the folder’s name (like changing plugins to plugins-disabled).

Again refresh your site. If you are still seeing the same error message, then you know it is not a plugin conflict.

If the error message is no longer showing and you’re able to see or access your site again, you know that one of your plugins is causing the issue. This is where you’ll need to go through and reactivate them one-by-one to find the source. Remember to change back the folder name once you’re done.

4. Rollback

If you have updated a plugin or made some changes to your site’s code, you may want to rollback to a previous version or a backup. You can access the plugins previous versions on their plugin page under Development Changelog.

Conclusion

If you still aren’t able to resolve the issue I recommend reaching out to your web host (depending on the level of support they give) or a web developer (like myself!) and they should be able to help.

Buy me a coffeeBuy me a coffee