# Template Hierarchy

#### [Home Page display](https://developer.wordpress.org/themes/basics/template-hierarchy/#home-page-display) <a href="#home-page-display" id="home-page-display"></a>

By default, WordPress sets your site’s home page to display your latest blog posts. This page is called the blog posts index. You can also set your blog posts to display on a separate static page. The template file `home.php` is used to render the blog posts index, whether it is being used as the front page or on separate static page. If `home.php` does not exist, WordPress will use `index.php`.

1. `home.php`
2. `index.php`

#### [Front Page display](https://developer.wordpress.org/themes/basics/template-hierarchy/#front-page-display) <a href="#front-page-display" id="front-page-display"></a>

The `front-page.php` template file is used to render your site’s front page.  If the `front-page.php` file does not exist, WordPress will either use the `home.php` or `page.php` files depending on the setup in Settings → Reading. If neither of those files exist, it will use the `index.php` file.

Work with either use latest post and static page homepage displays.

#### [Privacy Policy Page display](https://developer.wordpress.org/themes/basics/template-hierarchy/#privacy-policy-page-display) <a href="#privacy-policy-page-display" id="privacy-policy-page-display"></a>

The `privacy-policy.php` template file is used to render your site’s Privacy Policy page. The Privacy Policy page template takes precedence over the static page (`page.php`) template. If the `privacy-policy.php` file does not exist, WordPress will either use the `page.php` or `singular.php` files depending on the available templates. If neither of those files exist, it will use the `index.php` file.

* privacy-policy.php
* page.php
* singular.php
* index.php

#### [Category](https://developer.wordpress.org/themes/basics/template-hierarchy/#category) <a href="#category" id="category"></a>

Rendering category archive index pages uses the following path in WordPress:

1. `category-{slug}.php` – If the category’s slug is `news`, WordPress will look for `category-news.php`.
2. `category-{id}.php` – If the category’s ID is `6`, WordPress will look for `category-6.php`.
3. `category.php`
4. `archive.php`
5. `index.php`

#### [Tag](https://developer.wordpress.org/themes/basics/template-hierarchy/#tag) <a href="#tag" id="tag"></a>

To display a tag archive index page, WordPress uses the following path:

1. `tag-{slug}.php` – If the tag’s slug is `sometag`, WordPress will look for `tag-sometag.php`.
2. `tag-{id}.php` – If the tag’s ID is `6`, WordPress will look for `tag-6.php`.
3. `tag.php`
4. `archive.php`
5. `index.php`

#### [Search Result](https://developer.wordpress.org/themes/basics/template-hierarchy/#search-result) <a href="#search-result" id="search-result"></a>

Search results follow the same pattern as other template types:

1. `search.php`
2. `index.php`

#### [404 (Not Found)](https://developer.wordpress.org/themes/basics/template-hierarchy/#404-not-found) <a href="#id-404-not-found" id="id-404-not-found"></a>

Likewise, 404 template files are called in this order:

1. `404.php`
2. `index.php`
