• I have started using the following block of code to output the path and template file currently in use in the header of my site. I use this for development purposes, so I can quickly see what template file is being used to display the page:

    /** ---------- BEGIN SHOW THE TEMPLATE PATH ---------- **/
    add_action('wp_head', 'show_template');
    function show_template() {
    	global $template;
    	echo "
    <!-- BEGIN TEMPLATE PATH -->
    
    ";
    	print_r($template);
    	echo "
    
    <!-- END TEMPLATE PATH -->
    ";
    }
    /** ---------- END SHOW THE TEMPLATE PATH ---------- **/

    I put this in functions.php. My question is; is leaving this path visible in the header code increasing my site’s vulnerability from a security standpoint? If so, do you have any better suggestions on how to quickly ascertain what template file is being called on any given page?

  • The topic ‘Is it secure to echo template path in header?’ is closed to new replies.