What file is this page using? – What The File

When I started off with WordPress I had trouble finding out what file I needed to edit to change the page I was viewing in my browser. I’ve checked the Template Hierarchy dozens of times, trying to figure out what file was loaded by WordPress to display my page.

What The File

I figured that I wasn’t the only one with this problem, everyone starts a beginner. In time you can dream the WordPress Template Hierarchy, but until then you might want to check out a plugin I wrote called What The File.

what-the-file-screenshot

What The File adds an option to your toolbar showing you what file is used to display the page you’re on. If you want to you can click the file name to edit it directly through the theme editor, though I don’t recommend this for bigger changes. Since version 1.1.0 What The File also supports Roots Theme based themes.

What The File can be downloaded from the WordPress Plugin Directory or by clicking here. For support please visit the Support forum.

Related Posts

Powered By Related Posts for WordPress
Click Here to Learn More About Related Posts for WordPress

40 thoughts on “What file is this page using? – What The File

  1. […] What file is this page using? – The WordPress Template Hierarchy » […]

  2. Yes! Thank you! I was looking for something like this when I first started themeing pages, I’m sure this will come in handy for a lot of people.

  3. Good one. I would recommend one minor improvement.

    Line 86:
    global $current_user;

    change to

    $current_user = wp_get_current_user();

    Than you’ll miss the “Notice: Trying to get property of non-object in xxx\wp-content\plugins\what-the-file\what-the-file.php on line 87” message in WP Debug mode.

  4. I love the concept of the plugin, and installed it as soon as I found it.

    Alas, I’m not loving what it does. Or I should say doesn’t do.

    If there’s been an option added to my toolbar to show me the file I’m on, I’m sure not seeing it. Desperately want to though!

  5. Much needed! Thank you very much 🙂

  6. Very helpful Plugin. Thank you very much

  7. Thank you! Exactly what I needed!

  8. Love this , quick question in most themes it shows fine but some themes it dont show at all, could that be cuz the theme is dark? what in a particular theme will cause it not to show. I already checked ADMIN USER to make sure that Show Toolbar when viewing site is CHECKED.. The theme has a admin area cuz it allow to check in logged in as admin so users can upload videos. If not logged in as admin them changed to login.

  9. found the answer in functions.php i removed code in there that was turning off admin bar overriding anything i was doing. Removed it now works, sorry for bothering you. Great plugin, i use it on all my test sites. Its wonderful especially on more complex pages that use multiple parts of a theme.

    /*function fw_wp_hide_admin_bar(){
    return false; TODD TURNED OFF
    }

    add_filter('show_admin_bar' ,'fw_wp_hide_admin_bar');
    */

  10. Excellent plugIn! Thank you for creating it. Much appreciate it.

  11. Thanks a lot man, your plugin has saved me so much debugging time! Otherwise I would hack every page on the site before finding which one was it finally using

  12. This is a very handy plugin. Thanks for saving me lots of time figuring out intrusive themes that try to do everything on its own.

  13. Excellent Stuff!

  14. Hi Barry,

    Great plugin, for the ones who get it to work 😉
    I left a question on the WP forum, hope you can help me out….

    thanks,

    rob

  15. Deborah Lanyon

    Fantastic!!! Thank you 🙂

  16. Just wanted to say thanks for this… it’s saved me so much time!

  17. I have a huge issue going on. I installed the plug-in on one of my blog sites, then imported some of the posts from that site into another site I have (just the posts, not the plug-in, never installed the plug-in on the new site), however I now have the template file being displayed on the top page of every page in my new blog. See: nmmlaw.com
    I need to get rid of this immediately. Please help!

  18. Where does the template information text get generated? Does it become a part of the database and the posts? The strangest thing was also that you didn’t even need to be an admin to see these, even on the other blog site I imported from.

    • Sounds like something is going terribly wrong on your website. This information does _not_ get generated, only displayed. And the information is only displayed to administrators!

  19. Hi Barry,

    Currently im using wordpress 4.2.2, and i tried installing this plugin. But the plugin seems not tested with latest version above. The plugin shows nothing on toolbar section with latest wordpress version. So can you test and make it work perfect with current wordpress version. Much Appreciated 🙂

  20. Torkild Smith

    I’ve installed it on several sites when I need to dissect them and it has saved me countless of hours!

    Is it too much to ask for a plugin analyzer as well ;-p
    I guess it is…

    Anyway… Great plugin!!!

  21. […] What The File Very useful when trying to figure out what file you need to edit to mess with the code of the page you are viewing. […]

  22. […] What The File Very useful when trying to figure out what file you need to edit to mess with the code of the page you are viewing. […]

  23. […] Source: What file is this page using? – What The File – Barry Kooij […]

  24. When alaysing WordPress templates, It is easy to get frustrated by clicking around in the template folders to locate the including mechanism. Specially when evaluating new WordPress themes. Advanced Themes might dig deep into “get template part” hierarchy. “What the file” WP plugin really solves this simple task.

    Sometimes files are included in a clever way you are not expected, and snippets of contents are showing up unexpectedly. I truly did use the Words “What the * !”

    After hours of lazy pasting __FILE__ constants into every file to monitor, I realized I needed a convenient hook, or maybe a lightway monitor approach, not a monitoring-everything plugin.

    “What the File” plugin by Barry Kooij really became a must use for our WordPress development, and a reminder about the great power of WordPress community.

  25. Ronak Sampat

    Great Work !!!

  26. OMG Thank uuuuuuuuuuuuuuuu

  27. This tool is so helpful for me. Thank you.

  28. Thank you for your good blog as always.Have a great day today

Leave a Reply

Your email address will not be published. Required fields are marked *