WordPress White Screen Of Death- How To Debug and Fix It?8 min read
The WordPress White Screen of Death scares you. I know why you are reading this article. It is because suddenly your whole website has stopped working and all you see is a deadly White Screen. You do not know what to do next and whom to pitch for help and hence you googled and found my website with the exact solution to your problem :p (Sounds Right).
Don’t worry, if you are facing the famous WordPress white screen horror then you are not alone here. Many people have already faced a similar problem including me and the solution is really easy to follow even if it is not so simple and straightforward.
What is WordPress White Screen Of Death?
Well, it is a situation where your WordPress website stops responding to any request and in-turn shows a white screen without any information about the issue.
The problem is very common and many people have already been a victim of this issue before. Although the problem is very common, it could still take a lot of time for a novice to figure it out.
There is only one thing which is happening behind the scene, PHP is throwing a fatal error because of some coding issue or plugin issue or theme issue. Ultimately, it comes down to the code.
On top of that, there could be a lot of reasons for PHP to face a fatal error but only one correct way to run the program. Let’s take a look at the causes and see if your recent changes to your website has become the reason for a Fatal Error for PHP.
What Causes WordPress White Screen of Death?
As I already told you that WordPress white screen of death is caused by a Fatal Error in the background. For security reasons, WordPress does not display those errors on the webpage which by the way is the best thing WordPress does. You would not want WordPress to show your server configuration or sensitive information to the user/hacker. The hackers might exploit these information leaks to breach security and compromise the entire system.
In addition to information leak, an errored out page gives a very bad impression to the users of that website. It could also result in a reduced traffic and user trust. You would not want to lose users trust, I’m sure of that.
There are several reasons for a White Screen of Death issue. It can be caused by badly coded plugins, corrupted plugins, invalid plugins, badly coded themes or some database issue. Some of the most frequent reasons for such an issue is listed below.
- Database Issue
- Unknown Cause
How to Fix WordPress White Screen Of Death?
When I faced this issue for the first time, I searched a hell lot of website to find the solution. Every website that talks about WordPress and blogging have a post on this issue. And every website content talks about one or the same thing.
But, here’s the surprising part,
None of those websites solved the problem that I was facing.
This is because the content present in all those websites are based on the common issues that are faced by the user and none of them pays attention to identifying the problem rather talks about the hit and trial method of solving the issue. If it is a hit then you are good otherwise you keep on beating the bush (it rhymes).
For example, you can take a look at the following post: https://www.shoutmeloud.com/fix-white-screen-death-wordpress.html.
This post will solve common issues but it does not talk about pinpointing the root cause in a single hit and directly solve the issue from there. On top of that, the methods told in this post are way too tiring. For say, if the issue is caused by one of your plugins then according to this post you will have to rename each plugin folder to something else and then refresh the page to see if everything works fine or not. If everything is okay that means the plugin you renamed is the culprit.
The method is straightforward but can you imagine doing this for every plugin. I currently have more than 30 plugins in my repository and if I go on renaming each one of them and then check which one is causing the trouble then it would easily take up an hour or more for me to find the issue.
In this post, I have talked about pinpointing the issue directly with the help of WordPress Issue Logging System.
Remember I told you about not displaying content on the screen to avoid information leakage. Well, this global PHP constant (inside
wp-config.php) is responsible for that behaviour.
define( 'WP_DEBUG', false );
By default, this constant is set to false in production version and true in development copies of WordPress. To pinpoint the cause of the error, you will have to set this constant value to true.
define( 'WP_DEBUG', true );
By doing this, you are telling WordPress to display errors.
I know you must be thinking that I only told you not to display errors in the first place to avoid information leaks and now I’m telling you to perform the same.
I understand your concern but wait, there’s more to it.
I’ve just asked you to set it to true, I’m not asking you to save the file right away. WP_DEBUG_DISPLAY is WP_DEBUG companion which we are going to use next.
Disable WP_DEBUG_DISPLAY (Companion to WP_DEBUG)
This constant controls whether the WordPress errors or warning message be shown inside of the HTML page. By default, it is set to true. That is why when you set WP_DEBUG to true WordPress automatically starts displaying error and warning message to the HTML page.
You will have to disable this constant by setting it to false. Copy and paste the below line just below the WP_DEBUG inside
define( 'WP_DEBUG_DISPLAY', false );
Note: For WP_DEBUG_DISPLAY to do anything, WP_DEBUG must be set to true.
At this point in time, you have told WordPress to produce DEBUG errors and warning but simultaneously you have also asked WordPress not to display those warning and errors in the HTML page. Now, all we are left to do is to channel these errors and warnings to a log file on our server from where we can safely check for the issue and debug it in a minute.
Enable WP_DEBUG_LOG (Companion to WP_DEBUG)
This is another global constant which helps use to channel all the errors and warnings to a log file on our server. By default, this constant is set to false. But you will be setting it to true.
define( 'WP_DEBUG_LOG', true );
Once you have set the WP_DEBUG_LOG to true, go back to your website and reload it. Your logs must be rolling now. You will still see the White Screen of Death but this time the error has been logged inside debug.log log file inside the /wp-content/directory.
Now, you can actually see what’s the root cause behind the white screen of death problem and take appropriate actions. In case you are wondering if it is safe to do it or not. Like what is the credibility of the information provided here. I would assure you that the above steps are one hundred percent safe and reliable and it comes right from the WordPress.org documents. You can follow the link to know more.
For the curious minds, my website is powered by DigitalOcean.If you are looking to make a shift from your existing hosting provider for a cloud solution then DigitalOcean is the best choice you have. Plus, DigitalOcean’s revised plans are very affordable and powerful. You will not want to miss those. You can read about a detailed review of DigitalOcean here.
Want To Setup Your DigitalOcean Account?
I will setup a DigitalOcean Account with WordPress (Optional) for less than $100. One time setup fees with three months support.
Click here! and fill in your details. I will contact you soon.
Please let me know your views on the same. Let me know if you find this article easy to follow or not. Tell me where I can improve to make this article even better and helpful for everyone. I would really appreciate your comments below with your experience whether you were able to solve the issue or not.
If you cannot identify the issue by yourself then copy and paste the issue below and I will help in debugging it better.
Like this post? Share it with your friends and family…