Debugging Template Fragments in WordPress

There are times when I need to see which template fragments are being pulled by WordPress. This bit of code helps to figure it out. You can put it in your functions.php file: add_action(‘wp_head’, ‘debug_template’); function debug_template() { global $template; print_r($template); }