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 my strategy I use in most of the WordPress installs I manage which allow 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']=='debug_mode') {
    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.

I hope this helps.