search ]

Show Template File Name in WordPress Header

To display which template file a page uses in the header, add the following code to your functions.php file:

add_action('wp_head', 'show_template');
function show_template() {
    global $template;
    print_r($template);
}

For more on template files, see WordPress Template Hierarchy.

Join the Discussion
0 Comments  ]

Leave a Comment

To add code, use the buttons below. For instance, click the PHP button to insert PHP code within the shortcode. If you notice any typos, please let us know!

Savvy WordPress Development official logo