If you have used WordPress, you must be familiar with the “There has been a critical error on this website.” error. It is one of the most common and most frustrating issues. It does not show any hints or clues about what exactly has gone wrong. If you don’t know your way around WordPress, it could be very frustrating figuring it out. In this article, we discuss how to troubleshoot and fix this issue. Let’s get into it.

What causes “There has been a critical error in your website” to occur?

This error occurs whenever there is a PHP error that disrupts the execution of code during loading of your website and WordPress in general. There is some code or script that you have added in your website that is causing this error. It can be a plugin, code snippet and in worst case scenario, a hack.

Let’s get started with the step-by-step approach to fixing this error.

Step 1 – Check All the Plugins

The most common cause for such an error is installing a buggy plugin. Plugins provide essential functionality to your website bin case the plugin being installed has bugs and errors, it could crash your site.So, we should check for any suspect plugins.

The Approach

In case you can access your dashboard, go to Dashboard > Plugins and try disabling them. If a plugin is at fault, you should be able to find out which plugin is causing the issue. You can then go ahead and disable it or if an update is required, update it.

But in most of the cases, if you are experiencing a “There has been a critical error” screen, you would not be able to access your dashboard. In such a scenario, if you can access your website using WP-CLI – a command line interface for WordPress. Your website needs to have WP-CLI set up. Check with your hosting provider if you can use WP-CLI for your website.

If you can access your website over WP-CLI, you can disable plugins using terminal. I won’t go in detail but basically the main command used in WP-CLI to disable plugins is –

You can try disabling your plugins over the command line and see if it fixes the issue. If the issue was caused due to a plugin, you should be able to detect the plugin and fix the issue. If not, read on!

Step 2 – Inspect your Theme

In case checking for plugins didn’t fix the issue, the other most probable source of “There has been a critical error on this website” error is the theme. WordPress Themes are responsible for the design and structure of your website. You need to check for the error in your theme.

Approach

As a normal user, the first step you need to take is make sure the theme is up to date.Usually, when WordPress is updated to a newer version, some functionality in a theme may be deprecated and hence cause an error.

In case theme is up to date, try switching your theme and set it to a WordPress default theme such as Twenty twenty-four. If you have access to dashboard, you should be able to do it from Dahboard > Appearance > Themes. In case you don’t have access to dashboard and it is also showing the error, you can follow the same method as use previously  for plugins and try switching the theme using WP-CLI. The main command used to activate a new theme using WP-CLI is –

Also, note that these commands are for a single site install. These are different for a multisite install. For more information, you can always check out the official documentation.

You should be able to detect if the issue is in the theme. In case the issue is in the theme, you can either contact the theme developer or try finding a new theme for your website. Your decision depends on how invested are you in your theme.

If you are not interested in the code aspect of troubleshooting, you can just go ahead to step 4. But if you are familiar with code and have a DIY attitude wanting to fix it up yourself, let’s go to the next step.

Step 3 – Troubleshooting the Issue

By now, you should be able to figure out if the issue is in the theme or plugin. Here, we’ll talk about finding the exact issue and fixing it if possible.

Approach

You need to have access to your server and WordPress installation. It’s usually a public_html  folder in the hosting server. Open the wp-config.php file in a text editor. Most web hostings have an in-built editor which you can use to edit the files. You need to edit this file.

Try finding the following line of code –

Change it to –

. In case you don’t find this line of code in wp-config.php, just add the latter line before /* That's all, stop editing! Happy publishing. */ .

After adding and saving the file, try going back to your website and refreshing it. You should be able to see some error message on your screen like so –

There has been a critical error on your website troubleshooting

The message is pointing out to the exact location of the issue. If you have a basic familiarity with WordPress file structure and code, you should be able to locate the issue and fix it.

In some cases, adding define('WP_DEBUG', true); doesn’t show the exact error or is undecipherable. In such a scenario, you need to access the error logs stored in your server installation. All the errors encountered in the website are logged in a log file usually called php_error.log. You can check it out and find the latest entries in the file. They should point you in the right direction.

Step 4 – Ask for Support

By now, you have tried everything in your capacity as a normal user (or even as a website manager familiar with code if you went through step 3). If you are not able to pin point the exact issue and why the “There has been a critical error on your website.” screen is appearing, you need to contact your hosting provider. Sometimes, hosting servers have some caching plugins installed which can get corrupted and cause undue errors on websites.

Also, you can try reaching out to third-party services which provide which provide help with website maintenance and troubleshooting. We, at IndiThemes.com also provide such services for our customers helping them with maintenance, troubleshooting and optimization of their websites. You can reach out to us by filling the form to the right or contacting us at support@indithemes.com.

Conclusion

So, this was it! Our step-by-step guide to fixing the “There has been a critival error on your website.” error on your WordPress website. Hope you were able to fix the error you were having. It is quite a frustrating error which leaves many scratching their heads as to what has happened to their website. See you next time!

Meet the Author

Divjot Singh

Divjot is an experienced WordPress developer and technical writer with more than a decade of experience in WordPress Development. Whenever he's not creating amazing WordPress experiences, he can be found on the road with his bike.

Meet the Author

Divjot Singh

Divjot is an experienced WordPress developer and technical writer with more than a decade of experience in WordPress Development. Whenever he's not creating amazing WordPress experiences, he can be found on the road with his bike.

Leave a Reply

Your email address will not be published. Required fields are marked *