How to debug WordPress White Screen of Death and other Errors

How to debug WordPress White Screen of Death and other Errors

After so many requests asking about “WordPress white screen of death”, I would like to quickly share the strategy I use in most of the WordPress installs I manage which allows me to quickly switch on debug mode when required.

In the file wp-config.php, which can be found in your WordPress root, search for variable WP_DEBUG and replace it with

if (isset($_GET['debug']) && $_GET['debug']=='true') {
    error_reporting(E_ALL); ini_set('display_errors', 1);
    define('WP_DEBUG', true);
}

Now you can open any page, and if something goes wrong there, like a white screen of death, you can add ?debug=debug_mode to the end of its URL and check what’s causing the trouble. Eg. http://www.mywordpresssite.com?debug=true

I hope this helps.