Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: index_template_hierarchy

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
1446  * @param string $template_prefix Optional. The template prefix for the created template.
1447  *                                Used to extract the main template type, e.g.
1448  *                                in `taxonomy-books` the `taxonomy` is extracted.
1449  *                                Default empty string.
1450  * @return string[] The template hierarchy.
1451  */
1452 function get_template_hierarchy( $slug, $is_custom = false, $template_prefix = '' ) {
1453      if ( 'index' === $slug ) {
1454           /** This filter is documented in wp-includes/template.php */
1455           return apply_filters( 'index_template_hierarchy', array( 'index' ) );
1456      }
1457      if ( $is_custom ) {
1458           /** This filter is documented in wp-includes/template.php */
1459           return apply_filters( 'page_template_hierarchy', array( 'page', 'singular', 'index' ) );
1460      }
1461      if ( 'front-page' === $slug ) {
1462           /** This filter is documented in wp-includes/template.php */
1463           return apply_filters( 'frontpage_template_hierarchy', array( 'front-page', 'home', 'index' ) );
1464      }