WP Stagecoach has been acquired by the WP Masters! Please visit this page for more information.

What to do when you get a WordPress White Screen of Death

Anyone who has ever edited code on a WordPress site has been in this situation: you’re just chugging along, happily editing your files, and you save your file and hit refresh and……. blank screen.  It’s the dreaded White Screen of Death.  It happens to everyone.  So what do you do to fix your white screen of death?

What is the white screen of death?

First of all, what is the white screen of death and why does it happen?  When WordPress encounters a fatal PHP error, it really is fatal – WordPress can’t render anything if there is a fatal error.  Instead, you just get an empty browser window.  Unfortunately, the simplest of syntax errors can cause a fatal error in PHP – one missing semicolon or misplaced parenthesis can take down an entire site.

Use a staging site

That’s why it’s always a good idea to use a staging site instead of a live site any time you are editing code.  You don’t want something as simple as a semicolon to take down your site!  If you use a staging site every time you edit the code on your site, you don’t have to worry about your site visitors seeing the white screen of death.  And if you do get a white screen of death, it’s a lot easier to troubleshoot when you aren’t stressed out about doing it quickly!

Re-stage

Another great thing about working on a staging site is that they’re disposable.  If you haven’t made many changes on your staging site, you can just delete the staging site and make a new one.

Check Error Logs

You can look at your site’s error log to see what the exact problem is, and try to fix it.  How you access your error logs will depend on your web host – every host is a little bit different.  Some web hosts do not provide access to error logs (and if your web host doesn’t, you might consider switching to a host that does).  The error log will tell you where PHP encountered the fatal error, so you can edit the offending file and fix the error.  Unfortunately, that’s not always as easy as it sounds, depending on how experienced you are with PHP.  Sometimes it’s really easy to fix broken code based on the error message, and sometimes it’s really hard to figure out what is going on.  So if looking at error logs and fixing errors seems daunting, don’t worry – there are other steps you can take!

Replace the Broken File

If you know which file has the error, you can replace it.  Use FTP to delete the file, and then download a new copy.  If you’re using a staging site, you can download the file from your live site.  If the file is in a theme or plugin, you can download a new copy of that theme or plugin.

Disable the Offending Theme or Plugin

You can use FTP to disable the theme or plugin that is giving you a fatal error.  Connect to your site with FTP, and rename the directory of the broken theme or plugin.  For instance, if your theme is in the “my-great-theme” directory, you can rename that directory to something else, such as “my-great-theme-is-broken.”  When you rename the directory of the active theme, WordPress won’t be able to find the theme and will revert to a default theme such as TwentySixteen.  If you rename the directory of an active plugin, WordPress will disable the plugin.  This will get the site back up, and from there you can reinstall the theme or plugin if you need, or use a different theme or plugin.

Everyone encounters a white screen of death at some point.  Fortunately, there are a lot of different ways to fix it.  If you’re editing code on your site, it’s always a good idea to use a staging site so that you don’t have to worry about your site visitors seeing the white screen of death, and it’s easier to fix the white screen of death on a staging site.