What To Do If You Encounter A Fatal WordPress Error

by | Sep 1, 2018

What exactly do we mean by a fatal WordPress error and how would you know if one had occurred?

In this article we are assuming your website was working perfectly and then:

 

  • Some component was updated (click here to see my nightmare update)
  • Someone changed a setting in a file
  • A hiccup at your hosting company or in a download caused a file to become corrupted
From your point of view one of two things might happen as a result. Either your website (both the front-end and the dashboard) will return just a plain white web page (this is called the WordPress White Screen of Death or WSoD for short) or you will see the screen shown here.

First of all (as always) do not panic!

Fatal WordPress Error - Second test page error HTTP 500

RECOVERING FROM A FATAL WORDPRESS ERROR – INTRODUCTION

In this article we are expecting that your dashboard is no longer accessible and you are dead in the water. Therefore, you will be using your favorite FTP client for the following steps.

Secondly this article also assumes that you have no idea what is causing your website to fail and you have no idea where to look. Check out this companion article that you can use in the event of a fatal WordPress error. It will indicate not only what plug-in or theme is causing your issue, it will also tell you the exact file and what line in that file is causing the error!

If you have no idea where the issue is located there are a few things you can try and I will walk you through the steps below. First of all, we know the issue is most likely in one of these places:

 

  • A plug-in file
  • The active theme
  • In WordPress itself

RECOVERING FROM A FATAL WORDPRESS ERROR – THE PLUG-INS

In many articles on this topic they will instruct you to simply deactivate your plug-ins one at a time until the issue resolves itself. If you cannot get into your dashboard, how can you achieve this? It is actually quite simple, you just rename the folders. I always like to just put some number eight symbols into the middle of the name. This is my signature troubleshooting method. It is easy to spot and easy to remove. Here I have deactivated some plug-ins just to show you an example.

Remove plugins

Since WordPress cannot find them, it cannot run them. The plug-ins are still installed (as they are registered in the database).  When your website is working and you have renamed the folders you will need to re-activate all the good plug-ins from your dashboard.

Once you have located the problem plug-in you either need to remove it (if you no longer need it), re-install it (if it was corrupted) or find a replacement if it is no longer compatible with your version of WordPress.

RECOVERING FROM A FATAL WORDPRESS ERROR – THE THEMES

I have seen articles where they say “just deactivate your current theme and WordPress will revert to the last installed theme”. This sounds great but once again how do you deactivate a theme if you no longer have access to your dashboard? The answer as before is to rename the theme folder. If WordPress cannot find the theme, it cannot run it. Also rename your child theme folder if you are using a child theme. In my case I renamed Divi to Di888vi and Divi-Child to Di888vi-Child.

Now we are going to answer two questions that might be on your mind. What if you only had one theme installed? In that case I would recommend that you download one of the twenty-something themes from this location: https://wordpress.com/themes/free?s=twenty

Fatal WordPress Error - Download WordPress theme
Fatal WordPress Error - Twenty something themes

Unpack the zip file and place the theme in your theme folder on your website.

Regardless of whether you had a theme installed or you had to manually install it using the steps above, WordPress will always know to just revert to that theme, right? WRONG!! At least it did not in my case. I was greeted with the dreaded WSoD. However, this situation is really good for you because if I experienced it, I can walk you through how to recover.

RECOVERING FROM A FATAL WORDPRESS ERROR – MANUALLY SETTING THE ACTIVE THEME

I needed to dig into the database and manually re-point WordPress to the theme I wanted it to use.

These steps might vary depending on your hosting provider. I was using GoDaddy at the time this article was written. First I had to find the website details and in there discover the name of my database.

Fatal WordPress Error - Get Database Name
Armed with that bit of information I was able to use phpMyAdmin to open the database.

Then I needed to find the database table that contains the configuration information. This table is called wp_options (unless you changed the wp prefix to something else in your database due to security concerns).

Find database
Find Database table

Inside this table (usually somewhere between rows 40 to 45) you will find the option_name values of template and style sheet. Before I changed these the template was Divi (the name of the parent theme) and the style sheet was Divi-Child (the name of the child theme). I changed both of these to twentysixteen, refreshed my web page, and my website sprang back to life.

Find row and edit

RECOVERING FROM A FATAL WORDPRESS ERROR – WORDPRESS

You might also have a corrupted version of WordPress. I personally have never seen this happen but it is possible. (Update – this happened to me after I wrote this article and I documented the experience here.) Typically you would re-install WordPress by using the features of your web hosting company. (If this is not possible you can download WordPress from this location: https://wordpress.org/download/)

In this instance, these are the steps I would recommend:

  1. Save all the contents of the wp-content folder
  2. Backup your database
  3. Save copies of any other files you customized (such as .htaccess)
  4. Backup everything else (if you are concerned and want to be safe)
  5. Delete your WordPress installation
  6. Re-install WordPress
  7. Replace all the contents of the wp-content folder and any other files you customized
  8. Restore your database from the backup

This is a safe approach because in a previous article I shared that if all you have is your wp-content folder and your database and everything else is corrupted, you can blow away WordPress, restore the wp-content folder, restore the database and your entire site will return.

WRAPPING UP

In conclusion I hope this article was helpful in case you ever encounter any of these fatal WordPress errors. As mentioned before, I am writing a companion article that will provide the exact steps necessary to pinpoint what is causing your website issues. By using this article you will know whether it is a plug-in, theme, or WordPress itself that needs to be replaced. It will also provide the file name where the error occurred and in some cases the exact line number in that file.