How to fix critical WordPress error

Since WordPress 5.3 there is a new error notification system in WordPress that informs you that there has been a critical error on this website, and that the day you see it for the first time it will make you panic.

But nothing further, precisely what you have to do is be methodical and start doing some quick checks and applying solutions.

Looking for possible culprits

Before you start doing crazy "things", you must 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 a plugin or theme?
  • Have you uploaded something via FTP or the hosting file manager?
  • Have you added any custom code?
  • Have you updated the WordPress version?
  • Have you changed the PHP version?

Once you have answers to the previous questions, to ensure, we are going to take a previous step ...

Looking for real culprits

To be able to analyze possible errors and, from there, determine what is causing the critical errors in WordPress, the next thing I recommend is to activate the WordPress debugging mode.

To do this, open the wp-config.php file and add the following:

define ( 'WP_DEBUG', true);

define ( 'WP_DEBUG_LOG', true);

define ( 'WP_DEBUG_DISPLAY', false);

Save the changes, now you will have a record of the 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 culprit plugins

If you suspect that the problem has been caused by a plugin, it is clear where to start. And the first thing is to deactivate them all.

To do this, go to the WordPress installation via FTP or the hosting file manager and rename the 'plugins' folder. 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 suddenly deactivated.

Access your WordPress administration, check that ALL plugins are inactive and take any action that previously caused a critical WordPress error to see if it continues.

If you no longer receive the critical error, you can assume that one of the plugins is the culprit, for which I recommend that 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 every time you activate a plugin it checks if the critical error is generated.
  • When you detect the plugin that causes critical errors, leave it disabled, activate the rest, checking that no other plugin generates critical errors.

Fixing faulty plugins

If you have detected a plugin, guilty of critical errors, my advice is that in principle do not rule it out, as it may be the perfect plugin, and just for once it generates errors you will not do without it.

Before you have to test if it has been a recent update that causes the critical errors, and to know it nothing is easier.

Access the plugin page, normally on and activate the "Advanced View".

Choose a version older than the one you have installed and, once downloaded, go to your WordPress plugin installer 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 in which you can replace the current version with the recently 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 caused the critical errors, the next thing you should do is notify the author of the plugin.

With this you will not only get the author's thanks, but you will soon have an updated and error-free version of your favorite plugin.

Looking for guilty subjects

If after making the previous checks none of the plugins is the culprit, we will go on to check if the culprit is the active theme.

The first check is simple, simply activate (and install it previously if you did not have it) one of the default WordPress themes, any of the TwentyAlgo.

If the default theme does not produce critical errors then you have all the ballots that it was an update of your theme that caused them.

Fixing guilty issues

Unfortunately there is no advanced view on the themes page, and I am not going to make you navigate the subversion repository to do a manual process which can get quite tedious.

So what I propose is to use a plugin called WP Rollback, which is a gem that allows you to go back to old versions of plugins and themes quickly and easily.

Once installed and active there is nothing to configure, 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 «Back».

Pressing it will show you a list of all previous versions of the theme, allowing you to choose the one you want to return to.

And, before going back, you will see a warning screen, which never hurts to remind you to make backup copies 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 have to check if there are no more critical errors. If you have found the problem, as before, notify the developer of the theme in their support forum.

Looking for culprit 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.

Fixing faulty custom codes

To do 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 solved then you already know that the culprit is ...

Your custom code.

Or the PHP version, due to compatibility problems between the two.

Looking for culprit PHP versions

Whether you have detected critical WordPress errors that were generated by a plugin, the theme or some custom code, it may not really be the real culprit, 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, all kinds of errors can be generated, also critical WordPress errors.

So I would always check that the fault is not an incorrect PHP version, incompatible with any of the elements (plugins, themes, codes) on the web.

Fixing faulty PHP versions

Fortunately, the process of changing the version of PHP is now somewhat trivial in most modern hosting companies, which have adapted to new needs.

Somewhere on your panel you should find a section to change PHP version.

Then visit your website and check to see if there are still critical WordPress errors or the debugging warnings (debug) inform you of problems with outdated codes of some plugin, theme or code.

These error notices will put you on the trail of plugins or themes that use obsolete functions or not compatible with the active / desirable version of PHP, which should always be the latest stable available.

You can, momentarily, choose to use a lower version of PHP than recommended due to compatibility issues, but you should notify the plugin / theme developer as soon as possible to update it, as the current versions of PHP are the safest and fastest.

Searching if the culprit is WordPress

I almost forgot!

Yes, WordPress could also be the culprit of a critical WordPress error, it has happened after some updates, and it could happen again.

It is not that WordPress is poorly or poorly tested, it is that it is impossible to fully test the application used by 40% of the world's websites.

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's time to test to see if it was the fault of a recent WordPress update.

Date update on 2021-02-16. Date published on 2021-02-16. Category: Computer class Author: Oscar olg Fuente: ayudawp