How to Fix “There has been a critical error on your website” WordPress?

Updated on

 Fix Critical Error on your WordPress website

Fix WordPress Error “There has been a critical error on your website"

Specifically, the error that you will see on the screen is “There has been a critical error on your website.” The full error is:


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

There are various other versions of this error that comes up depending on what kind of changes you are doing:

  • wordpress critical error after php update
  • there has been a critical error on this website. wordpress install
  • there has been a critical error on this website. wordpress fix
  • there has been a critical error on your website. wordpress godaddy
  • wordpress critical error can’t login
  • wordpress critical error php 8
  • wordpress ” there has been a critical error on this website
  • wordpress recovery mode
  • critical error when activating woocommerce

If you have come this far it is because you were manipulating your WordPress as administrator and suddenly a message has appeared on the screen indicating that the site has technical problems.

Since WordPress version 5, thanks to the debugging mode, a message appears on the screen indicating that the site has technical problems. Here we see how to fix it.

There are a lot of common wordpress errors that you can encounter, like 500 internal server error504 Gateway Timeout error404 Page Not Found405 Method Not Allowed Error , WordPress File And Folder Permissions Error, Error Establishing a Database Connection in WordPress, White Screen of Death (WSOD) Error and many more. We have covered all these in depth.

What does this WordPress critical error mean?

There has been a critical error on you website

Between WordPress 5.2 and WordPress 5.3, we used to get the error message, “The site is experiencing technical difficulties.” But with the latest release of WordPress 5.4, WordPress developers have changed the message you receive. The developer has replaced the error message with There has been a critical error on your website.

What Causes “There has been a critical error on your website.” in WordPress?

WordPress 5.2 has a built-in feature that detects when a plugin or theme causes a fatal error on your site. it notifies you with this automated email. ”So it is clear that these types of problems generate PHP FATAL errors. FATAL errors occur when PHP stops working and requires you to troubleshoot issues before you can complete the process.

There are quite a few reasons you may experience critical 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?

When we have a website with WordPress and some of the plugins that we have active require the use of a lot of memory, or if the website has many concurrent visits, a high PHP memory consumption can occur. If the memory needs exceed the established limits, the error will occur on the web:

“There has been a critical error on this website”

The error is very generic and does not provide any information, since it is shown to all users who browse our website. Therefore, it is logical that for security reasons it does not show more information.

With a FATAL error, your request cannot be completed. Instead of showing broken pages with multiple errors, WordPress now displays a decent post. That’s it.

To debug the actual error that occurs and the reason, it will be necessary to activate the debug mode in WordPress. Next, we explain how to do it.

How to Debug & Fix Critical Error in WordPress?

Enable debug mode in WordPress

Check logs

Login to your site using FTP and check the error logs. If that doesn’t help, try enabling debug mode.

How to Debug & Fix Critical Error in WordPress - Enable Debug Mode

There are several options to activate debug mode in WordPress. One of the fastest and most efficient is to modify the wp-config.php file that will be at the root of our website. We will edit it and add the following lines (at the end, for example):

How to Debug & Fix Critical Error - Check Error Log

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.

PHP

define('WP_DEBUG', true);

define( 'WP_DEBUG_LOG', true );

define( 'WP_DEBUG_DISPLAY', false );

@ini_set( 'display_errors', 0 ); 

define('WP_DEBUG', true);

define( 'WP_DEBUG_LOG', true );

define( 'WP_DEBUG_DISPLAY', false );

@ini_set( 'display_errors', 0 );
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.

How to Debug & Fix Critical Error - WP-Debug-Log

The file may already contain some of these lines, if so we will check that it is the same and we will leave one of them. We will save the changes in the wp-config.php file and, from now on, WordPress will write any warning, notice or error that occurs on our website in the file:

/www/wp-content/debug.log

Enable debug mode in WordPress - fix critical error

With the previous lines we tell WordPress to save the possible errors that may occur in the debug.log file and NOT to show them on the screen.

This is highly recommended so as not to display sensitive information to the user who navigates to our website. Obviously, if we are developing the web and it has not yet been published, we can change the lines:

PHP

define( 'WP_DEBUG_DISPLAY', false );

@ini_set( 'display_errors', 0 );

1

2

define( 'WP_DEBUG_DISPLAY', false );

@ini_set( 'display_errors', 0 );

For:

PHP

define( 'WP_DEBUG_DISPLAY', true );

@ini_set( 'display_errors', 1 );

1

2

define( 'WP_DEBUG_DISPLAY', true );

@ini_set( 'display_errors', 1 );

This way it would show the errors on screen as well.

Consult the log file and analyze possible errors in WordPress

Once we have activated the debug mode, we can download or read the file directly:

/www/wp-content/debug.log

Which will have content similar to the following:

there has been a critical error on website - wordpress recovry mode

Depending on the log level, it will show us the Warnings, the Notices or the errors or all of them. In our case, it will show us all the log levels. We will mainly focus on the lines that start with “PHP Fatal error” or “Error”. And above all the “PHP Fatal error”, which are those that can cause the web to not be shown to the user.

There are other levels of error, but these are the most important. Now let’s learn how to solve it by upgrading your version of PHP.

Upgrade PHP to 7.4 Or Greater

WordPress is built with PHP and your hosting company sets its version.

Before you start updating your version of PHP, we strongly recommend that you make a backup of your site and the database. In case something goes wrong, you can restore your site from the backup.

Just like updating your WordPress plugins and theme, it’s also important to update your WordPress PHP to the latest version. There are mainly two reasons why you need to update your version of PHP:

Your WordPress site will be faster: The new version of PHP (currently 7.4) is more efficient. You can increase the performance of your site up to 3 or 4 times faster.

Your site will be more secure: WordPress is the most popular CMS and built with PHP. Hence, it becomes easy for hackers to hack a wordpress site. By updating your PHP, you will have the latest security features, which are missing from the previous version of PHP. Therefore, it is very important to update your PHP to the latest version.

Check your PHP version

To check your current PHP version you can create a new file let’s say serverinfo.php. Now edit this file and add the following code in the file. After that run file it will give you all information about the system your server is running.

Upgrade PHP to 7.4 Or Greater

Troubleshoot Theme Conflict Issues

To do this, simply activate a default theme, such as Twenty Twenty or greater. 

Unfortunately, because your site displays an error, you will have to troubleshoot issues with your host’s file manager (like cPanel file manager) or use FTP or sFTP (it’s like the secure version of FTP).

It is important to note that by changing the theme, you will not lose the settings of the chosen theme. 

To do this, rename your active theme folder by adding DISABLE or DISABLED at the end of the folder name. For example, if you are using Twenty Nineteen and the folder is “twentynineteen “, you would call it “twentynineteenDISABLE” or “twentynineteenOLD”. Come back to the top of your site and refresh.

The goal is to see if the error goes away. In case it doesn’t, it’s anything but a topic. Try to rename the organizer to their unique name when you have completed your survey.

Troubleshoot Plugin Conflict Issues

If that’s not the theme, it could be a problem with the plugin. In some ways, the troubleshooting is similar. However, it is much easier to rename the plug-in folder to “pluginsOFF”. Visit the site and log in. This will close all plugins. Note that this will not remove the original settings for these plugins, as they will be there when you re-enable them later.

Once the plug-ins are disabled, go back and rename the folder to “plug-in”. Go to your WordPress admin area and re-enable each one, one by one, until you see the screen saying “There has been a critical error on your website”. 

When you’ve discovered the problem, you probably need to restore the object or module that caused it. You can do this in several ways.

Download the original plugin files directly from the WordPress plugin directory and replace the plugin via File manager by your host (or cPanel) or via FTP or sFTP.

Use the WP Rollback plugin to restore the plugin to the previous version.

If you are using WP Rollback, there are several versions to choose from. It will tell you which version you have. Below you can follow the images to get a feel for how to use WP Rollback.

If you are using WP Rollback, there are several versions to choose from. It will tell you which version you have. Below you can follow the images to get a feel for how to use WP Rollback.

Choose the plug-in to restore. Click on “Rollback” if it is available in the plugins listed in your WordPress administrator.

Fix faulty custom codes

If none of the above worked, we will assume that neither the plugins nor the themes are the culprits, and the next thing to do would be to check if any of your custom codes have any incompatibility with the current version of WordPress, theme, plugins or PHP.

To fix this, simply delete the custom codes from the theme’s functions.php file or where you add them and check if there are no more critical WordPress errors.

If the critical errors are fixed then you already know that the culprit is…

  • Your custom code.
  • …Or the version of PHP, due to compatibility problems between the two.

Seeing a critical WordPress bug may seem worrisome, but at least now it alerts you, and even offers you a link to learn how to debug WordPress errors like syntax error.

In addition, your WordPress site will send you an email with instructions, and sometimes it will even activate the WordPress recovery mode.

If you don’t receive the email from WP, you can look at the server logs and get the entry related to this issue?

It can also help you find the solution. You can access the error log via FTP or cPanel by going to the root directory of the WordPress installation.

You can also talk to your hosting provider to find out the location where the error logs are kept as different for each host.

Need help from WordPress Expert?

No technical knowledge? We can fix There has been a critical error on your website for you? Contact Us right now and get your wordpress issues fixed instantly.