📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials WordPress Development Template Hierarchy

Template Hierarchy

5 min read Quiz at the end
Template hierarchy picks the most specific PHP template file — first match in the hierarchy wins.

Template Hierarchy

WordPress finds the correct PHP file based on what is being displayed — first match wins.

# Single post (most to least specific)
single-{post-type}-{slug}.php
single-{post-type}.php
single.php
singular.php
index.php

# Pages
page-{slug}.php
page-{id}.php
page.php

# Category archive
category-{slug}.php
category-{id}.php
category.php
archive.php

# Reusable parts
get_template_part('template-parts/content', 'post');
# Loads: template-parts/content-post.php
Topic Quiz · 1 questions

Test your understanding before moving on

1. In the WordPress template hierarchy, which file is the final fallback for any request?
💡 index.php is the final fallback — WordPress always falls back to it if no more specific template is found.