WordPress Template Hierarchy Explained
The template hierarchy is the fundamental logic WordPress uses to select the correct theme file for any given URL request based on specific rules.
Based on 12 community reports.
Linked sources: 2.
Known Issues
- Hierarchy can be confusing for beginners
- Child themes can override default hierarchy behavior
Community Q&A
What is the WordPress template hierarchy?
It is the system WordPress uses to decide which template file in your theme should be used to display a specific page based on the query.
How does WordPress choose a template file?
WordPress looks for the most specific file available in your theme folder first, then falls back to more generic files like index.php.
What is the fallback file in the hierarchy?
The index.php file is the final fallback template that WordPress will use if no other specific template file is found.
Reddit Sources
- The WordPress template hierarchy explained (r/ProWordPress)
- I was sick of hypey, low-value WordPress tutorials leading beginners astray. I created my own, shared it here, and the response blew me away. So I made a second free WordPress tutorial, this time 100% free and much deeper into web design. (r/Wordpress)