category_template_hierarchy
Filters the list of template filenames that are searched for when retrieving a template to use.
This is one of the variants of the dynamic hook (type)_template_hierarchy
Usage
add_filter( 'category_template_hierarchy', 'wp_kama_category_template_hierarchy_filter' );
/**
* Function for `category_template_hierarchy` filter-hook.
*
* @param string[] $templates A list of template candidates, in descending order of priority.
*
* @return string[]
*/
function wp_kama_category_template_hierarchy_filter( $templates ){
// filter...
return $templates;
}
- $templates(string[])
- A list of template candidates, in descending order of priority.
Changelog
| Since 4.7.0 | Introduced. |
Where the hook is called
category_template_hierarchy
wp-includes/template.php 62
$templates = apply_filters( "{$type}_template_hierarchy", $templates );