feature_image_How-to-find-which-WordPress-template-file-is-serving-on-the-current-page
Home » Blog » WordPress » How to find which WordPress template file is serving on the current page

How to find which WordPress template file is serving on the current page

Updated:   WordPress 1 min read

Your support helps keep this blog running! Secure payments via Paypal and Stripe.


As a WordPress developer, you often want to know which template is serving the page you want so that you can customize that template. I see so many methods on the internet, but I like this method because it is quick.

Here is the code that you will add to the functions.php of your active theme.

function show_template() {
    if( is_admin() ){
        global $template;
        print_r($template);
    } 
}
add_action('wp_footer', 'show_template');

We check if the login user is the admin, and we will show the current template at the footer. DON’T forget to remove it after you are done with developing.

I found this from this link. I think it is useful to share in my post.


Your support helps keep this blog running! Secure payments via Paypal and Stripe.


Share this:
Senior WordPress Developer (Freelancer)

Senior WordPress Developer (Freelancer)

I’m a professional WordPress and WooCommerce developer based in Chiang Mai, Thailand, with over a decade of experience creating fast, secure, and scalable websites. From custom themes and plugins to full WooCommerce stores, I help businesses build a strong and reliable online presence. Need a freelance WordPress developer you can count on? View my portfolio or get in touch to discuss your project.