Skip to content
Reference

WordPress Block Theme Template Hierarchy

For each common request type, the block theme templates WordPress looks for, most specific first, down to index.html, checked against WordPress 7.1.4 source.

For each request, WordPress checks these templates in order, most specific first, and uses the first one it finds among your theme's /templates files and any templates saved in the Site Editor. The chain always ends at index.html.

Front page

The site's front page, whether it is set to your latest posts or a static page.

  1. front-page.html
  2. home.html
  3. index.html

front-page.html wins whichever option Settings → Reading uses. The chain shown is for "Your latest posts". If the front page is a static page and there is no front-page.html, WordPress moves on to the static page chain (an assigned custom template, page-{slug}.html, page-{id}.html, page.html, singular.html), not to home.html.

Blog posts index

The page that lists your latest posts (the "posts page" in Settings → Reading).

  1. home.html
  2. index.html

If you chose a page as the posts page, its own assigned template and page-{slug}.html are not used. WordPress treats that URL as the blog index, not as a page, so it never checks the page chain: home.html comes first, and index.html always exists in a block theme, so the chain ends there.

Single post

An individual blog post.

  1. single-post-{slug}.html
  2. single-post.html
  3. single.html
  4. singular.html
  5. index.html

If the post has a custom template assigned in the editor's Template panel, that template comes first, ahead of single-post-{slug}.html.

Single custom post type

An individual entry of a custom post type (e.g. a "book").

  1. single-{post-type}-{slug}.html
  2. single-{post-type}.html
  3. single.html
  4. singular.html
  5. index.html

For a post type "book" with slug "dune": single-book-dune.html, then single-book.html, then single.html. An assigned custom template comes first, as for posts.

Static page

A regular WordPress page.

  1. page-{slug}.html
  2. page-{id}.html
  3. page.html
  4. singular.html
  5. index.html

Page with a custom template

A page assigned a custom template in the editor's Template panel.

  1. {custom-template}.html
  2. page-{slug}.html
  3. page-{id}.html
  4. page.html
  5. singular.html
  6. index.html

Theme-supplied custom templates are listed in theme.json's customTemplates array and live in /templates; templates created in the Site Editor are stored in the database. The assigned one wins over the whole page chain.

Category archive

The archive listing posts in one category.

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

Tag archive

The archive listing posts with one tag.

  1. tag-{slug}.html
  2. tag-{id}.html
  3. tag.html
  4. archive.html
  5. index.html

Custom taxonomy archive

The archive for a term in a custom taxonomy.

  1. taxonomy-{taxonomy}-{slug}.html
  2. taxonomy-{taxonomy}-{id}.html
  3. taxonomy-{taxonomy}.html
  4. taxonomy.html
  5. archive.html
  6. index.html

For a "genre" taxonomy and the term "sci-fi" with ID 12: taxonomy-genre-sci-fi.html, then taxonomy-genre-12.html, then taxonomy-genre.html.

Author archive

The archive of one author's posts.

  1. author-{nicename}.html
  2. author-{id}.html
  3. author.html
  4. archive.html
  5. index.html

Date archive

A year / month / day archive.

  1. date.html
  2. archive.html
  3. index.html

There are no separate year, month or day templates: date.html covers all three.

Post type archive

The archive index for a custom post type that has has_archive set.

  1. archive-{post-type}.html
  2. archive.html
  3. index.html

404 (not found)

Shown when no content matches the URL.

  1. 404.html
  2. index.html

Attachment page

The page for a single media attachment.

  1. {type}-{subtype}.html
  2. {subtype}.html
  3. {type}.html
  4. attachment.html
  5. single-attachment-{slug}.html
  6. single-attachment.html
  7. single.html
  8. singular.html
  9. index.html

The first three come from the file's MIME type: for a JPEG (image/jpeg) that is image-jpeg.html, jpeg.html, image.html. Sites installed on WordPress 6.4 or later have attachment pages switched off, and the attachment URL redirects to the file itself, so none of these templates is used. Sites upgraded from an older version keep them on.

Privacy policy page

The page set as the site's privacy policy in Settings.

  1. privacy-policy.html
  2. page-{slug}.html
  3. page-{id}.html
  4. page.html
  5. singular.html
  6. index.html

privacy-policy.html is checked before the page chain, so it beats even a custom template assigned to that page. Without it, the normal page chain applies (an assigned custom template first). With the default slug, page-{slug}.html is page-privacy-policy.html.

How this differs from the classic (PHP) hierarchy

  • Templates are .html files in /templates, not .php files in the theme root. A block theme does not need a single.php; it uses single.html.
  • Reusable regions such as the header and footer are template parts in /parts, placed with the Template Part block (wp:template-part) inside the .html files. There are no get_header(), get_footer() or get_template_part() calls.
  • index.html is required. A block theme without templates/index.html is not a valid block theme, and it is the final fallback for every route above.
  • WordPress treats a theme as a block theme when templates/index.html exists (or block-templates/index.html, the older folder name). theme.json is not part of that check, and there is no header flag.
  • If the theme also contains a PHP template that WordPress finds for the request (a hybrid theme, for example), only .html templates at least as specific as that PHP file are considered.
  • You can edit any of these templates in the Site Editor (Appearance → Editor). The saved copy is stored in the database and overrides the theme's file until you clear the customizations, which is why changing the file on disk can appear to do nothing.

How to see which template WordPress used

Open the page on the front end while logged in as a user who can edit theme options (an administrator, by default) and choose Edit Site in the admin bar. Since WordPress 6.3 that link opens the Site Editor on the template that rendered the page you were viewing, so you can see its name at once. In code, the global $_wp_current_template_id holds the same template's ID, in the form theme-slug//template-slug, once WordPress has picked it.

If the name is right but your edit to the file still does not show, a copy saved in the Site Editor is probably overriding it, as described in the last point above.

Child themes

With a child theme, WordPress collects the templates of both themes. If both have a template with the same name, the child's copy wins. Otherwise each chain still runs most specific first across both themes, so a parent's single-post.html beats a child's single.html. Read from the WordPress 7.1.4 source, not run on a site.

Changing a chain in code

Each list of names WordPress checks passes through a {$type}_template_hierarchy filter first, such as single_template_hierarchy or page_template_hierarchy (available since WordPress 4.7), so a plugin or theme can add, remove or reorder names. The filter receives the names with .php endings, as in the classic hierarchy; for a block theme WordPress drops the ending and looks for the same names as .html templates. Read from the WordPress 7.1.4 source, not run on a site.

Related guides and tools

  • Block template not applying? Why WordPress picks a different template than the one you edited, and how to find the file that wins.
  • theme.json explained: the settings and styles file that sits next to these templates, including where customTemplates are declared.
  • The theme.json generator builds a block theme's colour palette, font sizes, spacing and layout widths without hand-writing JSON.
  • Block theme vs classic theme: what changes when templates are HTML files instead of PHP.
  • The same chains are available as open data in JSON, free to reuse under CC BY 4.0.

Sources

Each chain, the child theme rule and the filter were read from the template loader and template functions in the WordPress 7.1.4 source on 2026-11-16, not tested on a running site.