home_template_hierarchy
Filters the list of template filenames that are searched for when retrieving a template to use.
Это один из вариантов динамического хука (type)_template_hierarchy
Использование
add_filter( 'home_template_hierarchy', 'wp_kama_home_template_hierarchy_filter' );
/**
* Function for `home_template_hierarchy` filter-hook.
*
* @param string[] $templates A list of template candidates, in descending order of priority.
*
* @return string[]
*/
function wp_kama_home_template_hierarchy_filter( $templates ){
// filter...
return $templates;
}
- $templates(string[])
- A list of template candidates, in descending order of priority.
Список изменений
| С версии 4.7.0 | Введена. |
Где вызывается хук
home_template_hierarchy
wp-includes/template.php 62
$templates = apply_filters( "{$type}_template_hierarchy", $templates );