Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Check which template loading in WordPress site.
* Check Which Template Loading
* @todo Change the `prefix_` from function name with your own prefix.
* @since 1.0.0
if( ! function_exists( 'prefix_check_loaded_template' ) ) :
function prefix_check_loaded_template()
// This global variable contain the currently loaded template file path.
global $template;
<div class="loaded-page-template">
<h3><?php _e( 'Template File:', 'prefix' ); ?></h3>
<p><?php echo esc_url( $template ); ?></p>
<!-- SKIP the styling. Just for reference. -->
<style type="text/css">
.loaded-page-template {
position: fixed;
right: 0;
top: 0;
z-index: 99999999999;
background: #FFEB3B;
padding: 15px 20px;
.loaded-page-template h3 {
margin-bottom: 10px;
font-weight: bold;
.loaded-page-template p {
margin-bottom: 0;
add_action('wp_head', 'prefix_check_loaded_template');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment