With the release of new versions of WordPress, plugins, and themes by updating them may end up with WordPress critical errors. This may happen in your life-time when you are dealing with a WordPress website and the issue will say “There has been a critical error on your website” as the main message. I hope this is not a major issue and it can be solved with few fixes.
Once the issue is triggered, you will receive error details to the admin email. So go check the mail in detail about the critical errors and start recovering the WordPress website to make error-free without building from scratch.
You may wonder what causes these errors and never thought about the future this may be a challenge. WordPress critical errors occur may be due to outdated PHP, WordPress, plugins, themes that are not compatible with the new version of the features. So if you face any of the wp critical errors in the future, in this article we will let you know how to fix these critical errors in WordPress step by step as shown below.
To analyze and fix the WordPress critical errors, let's take the website back-up both files and database before working on errors step by step in detail.
There may be many critical errors in WordPress which has triggered this, some of the reasons are
Now you have understood where the critical error has occurred whether it's a plugin, theme, hosting issue, PHP error, or WordPress updation error. These errors may not be able to see the website properly or access the WordPress dashboard.
To know exactly, where is the error you can turn on wp debug by editing the code.
Go to the wp-config.php file from the control panel or from FTP. Now check for the file wp-config.php to edit and find below code
define('WP_DEBUG', false);
Now Replace 'false' with 'true'
define('WP_DEBUG', true);
If the WP_DEBUG is false, you may not be able to see the WordPress critical errors from the plugin, or themes, or PHP version, or the WordPress version itself. By changing from 'false' to 'true', you can see all the errors triggered to the site and can be easily solved with few fixes. Once all the critical errors are fixed, you need to change WP_DEBUG to false to make sure the errors are not displayed on the home page.
Most of the time plugins may cause WordPress critical errors due to incompatibility of the WordPress version. Because these plugins features may not be available or in-compatible with new WordPress which results in WordPress FATAL errors and the website does not run properly.
Before beginning the process, please take a website backup and database for safety purposes. If you are using Cpanel then go to
file manager->public_html->wp_contents->plugins.
Now change the ‘plugins’ folder name to ‘plugins-new’ which will disable all the plugins and remove any errors triggered from plugins. Now refresh the website, make sure it is loading properly without any issues. But if the critical error is still visible, then the plugins are not the main problem.
If the error is cleared from the site, then rollback the wp_contents->plugins_new to just ‘plugins’. All the plugins you have installed previously will be in-active state, it needs to be activated one at a time. If any unwanted plugin is still in your space then it needs to be deleted.
Again before rolling out the theme, please make sure you have the site back-up and database backup. To check whether the theme has any issue that is causing WordPress critical error, now goto wp-content -> theme->theme-name and change the ‘theme’ folder name to ‘theme-name-new’.
This will make any theme installed will be deactivated, this is called the rollback technique by temporarily deactivating the current theme. Just refresh the website, if it works properly then the theme is the error that has triggered this. Now change the folder name back to original from ‘theme-name-new’ to ‘theme-name’, once done it's time to log in to dashboard install and activate default theme to make the website run smoothly.
If your website hosting control panel has not been upgraded to a new PHP version, then running a new WordPress version may trigger WordPress critical errors. So please contact your hosting provider to upgrade the latest PHP version and run the future WordPress version without any glitches.
Conclusion
Solving WordPress critical errors does not take much time, just need to have basic knowledge of PHP, WordPress, plugins, themes, and hosting control panel. If you have the skills, and patience to identify where exactly the issue is triggered, once identified follow the step-by-step procedure to fix it.