DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
Block Themes

How to Find Which Files to Edit in a WordPress Theme

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

There is no single WordPress theme file to edit: WordPress selects a template according to the page being requested, then uses the most specific matching template available. First identify whether your active theme is classic or block-based, then trace the matching template and check for child-theme or Site Editor overrides.

1. Identify the active theme type

The file you need depends first on the theme system in use. A classic theme uses PHP template files; a block theme uses HTML files containing block markup. The two systems have different locations and override behavior.

Theme type Template files Reusable sections Where to start
Classic PHP files such as single.php, page.php, archive.php and index.php. May use PHP template parts. Identify the request type and follow the classic template hierarchy.
Block HTML block templates in /templates/; index.html is required. HTML parts in /parts/, often headers and footers. Check the Site Editor for saved templates and parts before editing theme files.

Theme files and the WordPress editor interface can help you tell which workflow applies. A theme’s style.css is required for theme information, but it is not necessarily where a layout or visual change belongs: templates, parts and global styles may control the result. See the WordPress theme structure and getting-started guidance.

2. Name the view you want to change

Be precise about where the change should appear. Is it the front page, one post, a page, a category archive, search results, a 404 screen, or a section shared across several views? WordPress chooses templates based on the request, so describing the view narrows the candidates.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a classic theme, use the WordPress template hierarchy to trace candidates from specific to general. WordPress uses the first available match. For example, a category archive can check these files in order:

  1. category-{slug}.php
  2. category-{id}.php
  3. category.php
  4. archive.php
  5. index.php

The same principle applies to other request types: choose the hierarchy for the view you identified rather than assuming a particular filename controls every page. In classic themes, index.php is the general fallback.

3. Check which version of the template takes precedence

Classic themes: account for child themes and specificity

A matching child-theme template can override its parent-theme counterpart, but do not assume that any child file automatically wins. Hierarchy specificity matters: a more-specific parent template can take precedence over a less-specific child template. Compare the matching candidates in both themes against the hierarchy before choosing a file. See WordPress’s template hierarchy documentation.

Block themes: inspect saved Site Editor templates first

A block template or template part edited in the Site Editor can be saved as a database record: templates use the wp_template type, and parts use wp_template_part. The original theme file remains in place, but the saved version may be the one WordPress renders. For block templates, the precedence is user-saved template, child theme’s /templates/ file, then the theme’s /templates/ file. Check the Site Editor before changing a theme file, or the edit may not affect the active version. See the block templates documentation and template parts documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Look for a reusable part before changing a whole template

If the same header, footer or other section appears on multiple views, the change may belong in a template part rather than a page-specific template. In block themes, parts are stored directly in /parts/ and referenced from templates. Editing a shared part can affect every template that uses it, so confirm where it is used before making a broad change. The WordPress template parts guide explains their role.

5. Check theme.json for global settings and styles

When the goal is a site-wide block setting or style rather than a particular page’s structure, inspect theme.json. It configures block settings and styles and can register templates and template parts. The final result may also be affected by WordPress defaults, the theme, a child theme, user configuration and filters; changing a theme value may therefore not be the only factor. See the global settings and styles documentation.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

6. Choose the file with this checklist

  1. Identify whether the active theme is classic or block-based.
  2. Name the exact view or request type that should change.
  3. For a classic theme, follow its hierarchy from most specific to the general fallback, checking child and parent candidates.
  4. For a block theme, check the Site Editor for saved templates or parts, then inspect the relevant /templates/ or /parts/ file.
  5. If the change is shared across views, look for a reusable part; if it is global styling or configuration, inspect theme.json.
  6. Make a backup or use staging or version control when available before changing theme files.

These checks distinguish the theme-file default from the version or configuration currently controlling the rendered page.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.