Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Find Which Files to Edit in WordPress Theme

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

We are often asked about how to find which files to edit in a WordPress theme.

WordPress themes consist of several different files. Sometimes it may be hard for beginners to figure out which files they should edit to make certain changes in their theme.

In this article, we’ll show an easy and quick way to figure out which files to edit in your WordPress theme.

Finding which WordPress theme file to edit

Understanding WordPress Theme Template Files

WordPress themes consist of several files. These include template files, custom template tags and functions, template parts, images, JavaScript, and CSS files.

All the top WordPress themes follow the official best practices. This means they use the standard file and template structure to organize all the code.

For instance, all WordPress themes have archive.php, single.php, functions.php, and other files.

Each of these files is used as a template to display a particular area of your WordPress website. For example, single.php is used to display single posts and page.php template is used to display a single page.

Understanding the WordPress template hierarchy gives you a better understanding of how WordPress works.

If you ever need to add code to your WordPress theme, then it also helps you figure out which files you may need to edit.

For more details, see our complete cheat sheet for the WordPress template hierarchy for beginners.

That being said, let’s take a look at how to easily find which files to edit in WordPress theme.

Finding Template Files to Edit in WordPress Theme

First thing you need to do is install and activate the What The File plugin. For more details, see our step by step guide on how to install a WordPress plugin.

The plugin works out of the box, and there are no settings for you to configure.

Upon activation, you need to visit the front end your website and you will notice a new ‘What The File’ menu in WordPress admin bar.

What the file menu

Now you need to just take your mouse over to the menu item, and it will display a drop-down menu listing the template files used to display this page.

Clicking on the file name will take you to the default WordPress file editor where you can edit that particular file.

WordPress theme file editor

However, we do not recommend using WordPress file editor to edit theme files because there is no undo option.

If you accidentally lock yourself out of your website, then you would have to use an FTP client to fix it. That’s why we recommend using a FTP client or the File Manager app in your WordPress hosting control panel.

You can edit theme files using any plain text editor like Notepad.

Making direct changes to your WordPress theme is also a bad idea. Those changes will disappear when you update your theme.

If you are just adding some CSS, then you can add it as custom CSS in WordPress. For all other changes to your theme files, you should create a child theme.

The ‘What The File plugin’ can help you locate the theme files that you need to copy and edit in your child theme.

Note: The menu item added by the plugin in the admin bar will be visible to all logged-in users, and it has a link to an external site. You should only use this plugin in the development environment such as a staging site.

We hope this article helped you find which files to edit in your WordPress theme.

You may also want to see our WordPress theme development cheat sheet or take a look at WordPress generated CSS classes that you can use to style your themes.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

12 CommentsLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Moinuddin Waheed says

    This is a bit developer oriented task but yes at times we get into the question to edit the file and get into dilemma of which one to edit to get the desired changes made.
    I used to think that it is always the functions.php file that is to be changed but no the change is to be made where it is desired.
    I will explore the plugin to see where we would need to make the edit and changes.
    Thanks for this tutorial guide. it is really helpful understanding these concepts better.

  3. Jiří Vaněk says

    Thank you for the tip. Sometimes, I need to make a change on a website, and one doesn’t immediately know which file to edit. This plugin can be a great helper in figuring out which template file is currently being used.

  4. Riyaz says

    Installing this plugin made my life easier. However, some of the themes just leave something like these:

    $has_sidebar = is_active_sidebar( ‘single-blog’ );
    do_action( ‘mytheme_page_header’ );

    and even some functions which I can find nowhere:
    mytheme_get_listings_image(‘mytheme-list’)

    Is there any way to find these things ?

    • WPBeginner Support says

      You would need to manually go through the files manually, normally those would be found in the functions.php file

      Admin

  5. mark Swift says

    Hi,
    nice article,
    but what if the files are not available in child theme which I have to edit ??

  6. Cos says

    If you copy template (.php) files to your child theme (so you can edit them and not lose your changes when the theme is updated) then what happens if the file you copied and edited is updated by the theme developer? Do you then lose the benefit of their update?

  7. Susan Sheridan says

    How about this same kind of tool for finding out which style sheets are being applied?

  8. Bond Shands says

    I had hoped to use these directions to change the Post Office Mailing Address line at the bottom of my blog. However, installing and activating the What The File plugin produced no discernible results. Nothing new appeared on my Menu Bar. Also, to be honest, your instructions left me in the dark about how I would see the plugin displayed when viewing the blog page I wished to see. (Also, I’m already a subscriber via an alternate email address).

    • WPBeginner Support says

      Hi Bond Shands,

      Each WordPress site uses a couple of templates which are loaded on each page. For example, the header and footer templates. In order to change your postal address you will need to edit the footer.php file. However, make sure that you backup your WordPress theme before making any direct changes.

      Thanks

      Admin

Leave a Reply to Cos Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WPBeginner Assistant
How can I help you?

By chatting, you consent to this chat being stored according to our privacy policy and your email will be added to receive weekly WordPress tutorials from WPBeginner.