5 Ways to Fix a Critical Error in WordPress

What Does “There Has Been a Critical Error on Your Website” Mean?

Some WordPress errors may block you from accessing the dashboard, displaying the message, “There has been a critical error on this website. Please check your site admin email inbox for instructions.”

"There has been a critical error on this website" message.

This message means that there’s a fatal PHP error on the site. It occurs when a PHP script stops running and is unable to complete its process.

To help its users, WordPress has a feature that detects when a plugin or a theme causes a fatal error and sends a notification to the admin email address. In the email, users receive more details about what is causing the issue.

Error details that users get on the email.

The email also contains a URL to access the site in recovery mode. Click the link to safely log in to the WordPress dashboard and fix the issue.

If you encounter this WordPress error and don’t see any email notification in your inbox, check your spam folder. However, there may be cases when site owners don’t receive the email and have to locate the issue by themselves.

5 Ways to Fix a Critical Error in WordPress

To fix a critical WordPress error, you have first to locate the cause of the problem. The notification email from WordPress provides more details about which file and line of code caused the issue, but don’t worry if you didn’t receive it.

There are five methods to locate and resolve the critical error in your WordPress site.

1. Check Error Logs

The first method is by checking the error_log file, which stores PHP error information. Use the File Manager of a File Transfer Protocol (FTP) client on your hosting account and go to home/[username]/.logs/error_log_[domain].

The file records four types of PHP errors – warning, notice, parse, and fatal. At the beginning of each log, you’ll see the type of error that was found. If you find a parse or fatal error, you’ll have to fix it.

Content of error_log file.

If you can’t locate the error_log file, ask your hosting provider for help. Keep in mind that the error_log file will only be available if you enable PHP error logging. To do so, configure the PHP settings from your hPanel.

PHP configuration panel on hPanel.

If you still can’t check the error log file, try the following method using the debug mode.

2. Debug WordPress

WordPress comes with a built-in debugging system that identifies code errors in the core software, themes, and plugins.

To activate the WordPress debug mode, open the wp-config.php file in your public_html directory. Then, find the following lines:

 

The “false” values mean that WordPress debug mode is deactivated. Replace “false” with “true” on all lines to activate it.

These four lines contain PHP constants. When they’re activated, they perform the following tasks:

  • WP_DEBUG – triggers the debug mode in WordPress.
  • WP_DEBUG_DISPLAY – shows debug messages on the pages’ HTML.
  • WP_DEBUG_LOG – stores error details in the debug.log file.
  • SCRIPT_DEBUG – runs the “dev” versions of core CSS and JavaScript files instead of the minified versions.

If you can’t find those lines in the wp-config.php file, simply add them to the script. Remember to input the “true” value on each line.

After enabling the debug mode, refresh your site. You should see the details above the error message.

"There has been a critical error on this website" message after WordPress debug is activated.

Fix the issue according to the instructions, and your site should work normally again. Deactivate the debug mode by changing the values to “false” once you’ve resolved the problem.

3. Solve Any Theme or Plugin Conflicts

The following method will help find conflicts in your theme and plugins.

Start by checking your theme. If you have access to the WordPress admin area, simply switch the active theme to a default one such as Twenty Twenty.

However, if you can’t access the admin panel, use the File Manager or an FTP client like FileZilla and go to public_html -> wp-content -> themes. Find your active theme’s folder and rename it into youractivetheme-disabled.

Once you’ve done that, reload the site. If it loads as expected, then there’s a conflicting theme present, and you may have to roll back to the theme’s previous version or get an entirely new theme instead.

On the other hand, if the error persists, you should check if there’s an issue with your plugins.

The process is similar to checking your theme. If you have access to the WordPress admin panel, disable all plugins.

If you can’t access the admin panel, use the File Manager or an FTP client and go to public_html -> wp-content -> plugins. Rename all plugin directories into yourplugin-disabled except the Elementor plugin folder if you have it installed.

If you’re using hPanel, there’s an easier way to do this. Go to the WordPress -> Plugins section and simply disable all plugins.

WordPress plugins configuration section on hPanel.

Refresh your site. If it loads normally, that indicates a conflicting plugin.

To find out exactly which plugin caused the error, you have to reactivate them one by one, reloading the web page every time.

If you’ve renamed your plugins’ folders, go to public_html -> wp-content -> plugins. Revert all plugin folders into their original directory names one by one.

4. Restore the Site From a Backup

Using this method, you need to restore the website files from a backup. An error like this is one reason why backing up your WordPress site is essential.

Using hPanel

To restore the backup files using hPanel, go to Files -> Backups and select Files backups.

  • 0 A felhasználók hasznosnak találták ezt
Hasznosnak találta ezt a választ?