single_template_hierarchy filter-hookWP 4.7.0

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( 'single_template_hierarchy', 'wp_kama_single_template_hierarchy_filter' );

/**
 * Function for `single_template_hierarchy` filter-hook.
 * 
 * @param string[] $templates A list of template candidates, in descending order of priority.
 *
 * @return string[]
 */
function wp_kama_single_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

get_query_template()
single_template_hierarchy
wp-includes/template.php 62
$templates = apply_filters( "{$type}_template_hierarchy", $templates );

Where the hook is used in WordPress

Usage not found.