Categories: WordPress Tutorials

There has been a critical error on your website[Fix]

You only know how it feels when your WordPress site goes down. This message “There has been a critical error on your website” is a pain in the head for the site owners.

Now if your site is broken, you need to know how to fix this issue. The delay in fixing will drive away your customers to your competitor. There are different ways that you should check to troubleshoot this critical error. Depending on the site, the issue and time taken to solve it may differ.

If you have faced this error, you know that it even blocks your access to the dashboard. All in all, you should understand that there is some PHP error on the site. It happens when a code is unfinished or when a wrong code is entered in the PHP file. It results in the incomplete process of the PHP scripts.

When WordPress identifies the issue due to theme or plugin, it sends a reminder to the admin email address. If you follow that email, it will somewhat help you to know what is happening wrong on the site. The email can be sometimes buried up in the spam folder. So, be sure to check it everywhere in the email. In extreme cases, if you are lucky you will receive no email at all. Furthermore, check the URL in the email to login into the admin panel to fix the issue. As the normal URL will not be working, you need to log in to this safe URL provided by WordPress to recover your site.

Find and Fix “There has been a critical error on your website”

Before fixing the problem you have to identify the root cause of the issue. As said above, the reminder email from WordPress gives a hint to you. If you have received this mail, then you may know that it contains details about lines of code or files that are causing the problem. However, if you haven’t received any mail you will have to read the post below to try to find out the issue on the site.

Here are some important checks that you should not skip if you are facing a critical error on your site.

Check Error Logs

If you did not receive an email from WordPress, then it is the best practice to check the error log on your server. Usually, critical errors are logged. Check the PHP error logs stored in the error_log file inside the public_html.

Check Error Logs

If you check the error log file, you will see that the PHP errors are written with notice, warning, fatal, and parse errors. Fix all the parse and fatal errors present in that file to solve the critical error message.

While accessing the error log file, you can either use cPanel or FTP to check the root directory where WordPress is installed. Since each host can store the logs in a different location try contacting your host to find out the exact location where error logs are stored. 

Turn on Debug Mode

Debug Mode helps you to find out the errors in the code, themes, or plugins.

First of all, find out the wp-config.php file in the root directory. Check these lines of code in your file:

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

Replace false with true in these lines. In some cases, if any of these lines are not present, you can add this line to the file. This will enable debugging mode in WordPress and you will be able to error details when you refresh your site.

Check the error type and act accordingly. When the error has been eradicated, replace true with false again to turn off the debugging mode.

Check Theme/Plugin Conflicts

Sometimes you may get the error message “There has been a critical error on your website” due to the conflicting theme or plugin. First, let’s begin the check with the theme. For this, you have to disable the active theme and activate the default WordPress theme present in the dashboard. If the error disappears, then you need to understand that there was a problem with the theme. If so becomes the case, then either you need to solve the issue present in your previous theme or you may prefer changing the theme.

But, if the issue remains the same even after changing the theme then you can consider carrying checks with the installed plugins. Deactivate all the plugins and check whether the issue is present or not. If the problem continues, then the plugin is not responsible for the issue. Else the plugin is responsible for the problem caused. To know exactly which plugin is throwing the error, you need to reactive each plugin one by one and check the error continuously. As soon as you detect the plugin, you may want to replace the plugin with another one.

In case if you are searching theme and plugin files in the localhost, you will get that easily inside xampp>htdocs>yourfolder>wp-content while in the case of the live site you need to either have access to FTP or cPanel to check the root directory.

Check Theme-Plugin Conflicts

The files are present inside public_html>wp-content depending on your host. The plugins and themes are stored respectively inside their own sub-folder.

Restore Site

It is necessary to create a backup of the site because of the situations like this. Regular backup in a regular period of time saves your time and work. If you have an updated backup of the site then you may upload the file when there was no error in the site.

Boom!! It’s simple.

In other words, restoring the site to an earlier version is the easiest and quickest way to solve any issue on the site.

Upgrade PHP Version

Depending on the host, you can upgrade the PHP version supported by that host. Sometimes, a particular host may not support the latest PHP version while other hosts already run on the latest version. This is not on your hands. However, you need to identify and choose the host that supports the latest version. Have a look at this post to know How to update PHP in WordPress

Conclusion

If you have seen the “There has been a critical error on your website” error message on your site, follow the steps mentioned in this post and let us know if it solves your problem.

Related Posts

  1. How to fix WordPress HTTP Error 500 (Internal Server Error)
  2. How to enable GZIP Compression in WordPress
  3. How to install WordPress on XAMPP Step by Step
Amar Raj Mahato

Amar Raj Mahato is a Digital Marketer who is currently working as a content creator and SEO specialist in CodeFlist.com

Recent Posts

How to fix 504 Gateway Timeout Error?

As a visitor of the site and website owner, it is awful to experience errors on the site. Error pages… Read More

3 years ago

How to fix 403 Forbidden Error?

In the present context, every business owner maintains their own site for the online presence. When something unexpected happens with… Read More

3 years ago

How to use WebP images in WordPress?

If there are too many images on your site, they are uploaded in either PNG or JPG format. Learning how… Read More

3 years ago