Since WordPress 5.3 there is a new WordPress error notification system that informs you that “There has been a critical error on this website”, and that the day you see it for the first time will make you panic.
But precisely what you have to do is to be methodical and start doing some quick checks and apply solutions.
Table of Contents
Looking for possible guilty
Before you start doing “things” in a crazy way, you should first stop for a moment and think…
- Have you installed or updated any plugins recently?
- Have you installed or updated the active theme recently?
- Have you deactivated or deleted any plugin or theme?
- Have you uploaded anything via FTP or the hosting file manager?
- Did you add any custom code?
- Have you updated your WordPress version?
- Did you change the PHP version?
Once you have answers to the above questions, we’ll perform a previous step…
Looking for real guilty
In order to be able to analyze possible errors and, from there, determine what is causing the critical WordPress errors, the next thing I recommend you to do is to enable WordPress debug mode.
To do this open the wp-config.php file and add the following:
Save the changes, and now you will have a log of errors in the debug.log file, where you can analyze if any plugin or script is generating critical errors.
If you identify the path of a plugin that is generating the errors, that will be a good candidate to know where to start.
Looking for guilty plugins
If you suspect that the problem is caused by a plugin, it is clear where to start. The first thing to do is to deactivate all of them.
To do this, access the WordPress installation via FTP or the file manager of the hosting and rename the folder ‘plugins’. Give it the name you want, what we will cause with this action is that all the plugins that you have active in your WordPress are deactivated at once.
Log into your WordPress administration, check that ALL plugins are inactive and perform any action that previously caused a critical WordPress error to see if it is still happening.
If you no longer receive the critical error you can assume that one of the plugins is the guilty, for which I recommend you do the following:
- Rename the plugins folder back to its original name.
- Access your WordPress administration and activate the plugins one by one, and each time you activate a plugin check if the critical error is generated.
- When you detect the plugin that causes the critical errors keep it deactivated, activate the rest, checking that no other plugin generates critical errors.
Fixing guilty plugins
If you have detected a plugin, guilty of critical errors, my advice is not to discard it, because it may be the perfect plugin, and only this time it has generated errors, so it may not be necessary to remove it.
First you have to test if it has been a recent update that causes critical errors, and nothing easier to find out.
Go to the plugin page, usually on WordPress.org and activate the “Advanced View“.
At the bottom of this page, in addition to a lot of interesting statistics, you will see an area to download previous versions of the plugin.
Choose a version prior to the one you have installed and, once downloaded, go to the plugin installer of your WordPress and choose the option to install the plugin by uploading the file.
After clicking on the “Install now” button you will be shown a screen where you can replace the current version with the newly uploaded one, which is what you should do, to check if previous versions of the plugin do not generate critical errors.
After these checks, if you have detected that it was a version of one of the plugins that was causing the critical errors, the next thing to do is to notify the plugin author.
Not only will you get the thanks of the author, but you will soon have an updated and error-free version of your favorite plugin.
Looking for guilty themes
If after performing the above checks none of the plugins is the guilty we will check if the guilty is the active theme.
The first check is simple, just activate (and install it previously if you didn’t have it) one of the default WordPress themes, any of the TwentySomething.
If the default theme does not produce critical errors then you have all the chances that it was an update of your theme that caused them.
Fixing guilty themes
Unfortunately there is no advanced view on the WordPress.org theme page, and I’m not going to make you browse the subversion repository to do a manual process that can become quite tedious.
So what I propose you is to use a plugin called WP Rollback, that allows you to roll back to older versions of plugins and themes quickly and easily.
Once installed and active you don’t have to configure anything, just go to the theme management screen and when you click on the active theme to see the details, you will see a new button called “Rollback” on the lower right corner.
Clicking it will show you a list of all the previous versions of the theme, and you can choose the one you want to go back to.
And, before backing up, you will see a warning screen, as it never hurts to remind you to make backups before modifying vital elements of your website such as plugins or themes.
If you are sure, the plugin will download the selected version and replace the current one with the chosen one.
Now you just need to check if there are no more critical errors. If you have encountered the problem, as before, notify the developer of the issue in their support forum.
Looking for guilty custom codes
If none of the above worked we will assume that neither plugins nor themes are to blame, and the next thing would be to check if any of your custom code has any incompatibility with the current version of WordPress, theme, plugins or PHP.
Fixing guilty custom codes
To do this, simply delete the custom codes from the functions.php file of the theme or where you add them and check if there are no more WordPress critical errors.
If the critical errors are fixed then you know the guilty is….
- Your custom code.
- … or the PHP version, because of compatibility issues between the two.
Looking for guilty PHP versions
Whether you have detected that the critical WordPress errors were generated by a plugin, the theme or some custom code, it may be that in reality none of these were the real guilty, but the version of PHP you have active.
Because if a plugin, theme or code uses obsolete or too advanced functions, incompatible with the version of PHP active on your server, it can generate all kinds of errors, including critical WordPress errors.
So I would always check that the guilty is not an incorrect PHP version, incompatible with any of the elements (plugins, themes, codes) of the web.
Fixing guilty PHP versions
The process of changing PHP version, fortunately, is nowadays trivial in most modern hosting companies, which have adapted to the new needs.
Somewhere in their panel you should find a section where you can change PHP version.
Next visit your site and check to see if there are still any critical WordPress errors or debug notices informing you of issues with obsolete code in any plugins, themes or code.
These error warnings will put you on the trail of plugins or themes that use obsolete functions or are not compatible with the active/desired PHP version, which should always be the latest stable version available.
You can, momentarily, choose to use a PHP version lower than the recommended one for compatibility issues, but you should notify the plugin/theme developer as soon as possible to update it, as the current PHP versions are the safest and fastest.
Looking to see if WordPress is the guilty
I almost forgot!
Well yes, WordPress could also be the guilty of a critical WordPress bug, it has happened after a few updates, and it could happen again.
It is not that WordPress is tested little or badly, it is that it is impossible to do a complete testing of the application used by 40% of the websites in the world.
There are so many combinations of plugins, themes, hosting, servers, that it can always happen that one of them causes critical WordPress errors.
So, if all of the above has failed, it is time to test to see if it was the fault of a recent WordPress update.
Fixing a guilty WordPress version
If you think that a WordPress update may be the guilty of the critical WordPress errors, it’s time to go back to the previous version of WordPress.
And since I already published a simple step-by-step guide on how to do it, here’s the link for you to follow…
Seeing a critical WordPress error may seem worrisome, but at least now it warns you, and even gives you a link to learn how to debug WordPress errors.
In addition, your WordPress site will send you an email with instructions, and sometimes it will even activate WordPress recovery mode.
Prior to WordPress version 5.3 what you had was THE WORDPRESS WHITE SCREEN OF DEATH.