WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
| Line | Code |
|---|---|
| 1515 | * @param string $template_prefix Optional. The template prefix for the created template. |
| 1516 | * Used to extract the main template type, e.g. |
| 1517 | * in `taxonomy-books` the `taxonomy` is extracted. |
| 1518 | * Default empty string. |
| 1519 | * @return string[] The template hierarchy. |
| 1520 | */ |
| 1521 | function get_template_hierarchy( $slug, $is_custom = false, $template_prefix = '' ) { |
| 1522 | if ( 'index' === $slug ) { |
| 1523 | /** This filter is documented in wp-includes/template.php */ |
| 1524 | return apply_filters( 'index_template_hierarchy', array( 'index' ) ); |
| 1525 | } |
| 1526 | if ( $is_custom ) { |
| 1527 | /** This filter is documented in wp-includes/template.php */ |
| 1528 | return apply_filters( 'page_template_hierarchy', array( 'page', 'singular', 'index' ) ); |
| 1529 | } |
| 1530 | if ( 'front-page' === $slug ) { |
| 1531 | /** This filter is documented in wp-includes/template.php */ |
| 1532 | return apply_filters( 'frontpage_template_hierarchy', array( 'front-page', 'home', 'index' ) ); |
| 1533 | } |