The white screen of death: How I broke and fixed my WordPress website

Many people enjoy WordPress due to its ease of use and the ability to quickly build custom posts. Sometimes, especially for beginners, things don’t go as planned and we end up breaking things in the process. While going through this troubleshooting may be annoying, it is an important learning experience that will build your skills and sharpen your abilities as a WordPress Developer. If you are reading this article because your WordPress installation is having this issue right now it may be too late but it is important to get into the habit of backing up your WordPress site before making any major changes to your code

The WordPress White Screen of Death
Oh no. The WordPress White Screen of Death

Create a backup before making any changes to the code of your website.

Once you have the backup you can code away with confidence, creating and changing any part of your website as you please. Having a recent backup does not mean you won’t break your site however fixing it is simply a matter of reuploading your files. This may be much easier than debugging and pouring through your code. That being said, searching, finding, and correcting bugs in your code will work in your favor and build your skills as a developer. If you’re lucky, the problem will be a simple typo and can be fixed within minutes. This can happen to anyone and fixing these errors can often be much faster than reinstalling from your last backup. A good place to start looking for the bug would be in the last file you made changes to before you noticed your website went down.

A good place to start debugging is in the last file you edited before your website went down.

The example issue in this post happened while adding a new custom post type to the functions.php page of the active theme in the SquaredCare WordPress Website. The bug was a missing comma after a label option that was not the last one in the array. Can you spot where the problem is?

Missing Comma

Thankfully that was the only bug in the code causing the white screen of death this time. There are other bugs that can cause the same issue without giving any context or error messages. This makes it important to build the habit of checking on your work early and often to make sure nothing is broken.

Check on your work early and often (before you make too many changes) to find bugs soon after they occur.

This gives you a great advantage in easily avoiding what can be a very frustrating and time-consuming problem. If you make too many changes before finding out there is an issue you may spend time looking at and changing code that did not cause the bug.

Leave a Reply

Your email address will not be published. Required fields are marked *