WordPress at a glance
filter is not described

(type)_template filter-hook . WP 1.5.0

Filters the path of the queried template by type.

The dynamic portion of the hook name, $type, refers to the filename -- minus the file extension and any non-alphanumeric characters delimiting words -- of the file to load. This hook also applies to various types of files loaded as part of the Template Hierarchy.

Possible values for $type include: 'index', '404', 'archive', 'author', 'category', 'tag', 'taxonomy', 'date', 'embed', 'home', 'frontpage', 'page', 'paged', 'search', 'single', 'singular', and 'attachment'.

Usage

add_filter( '(type)_template', 'filter_function_name_8723', 10, 3 );
function filter_function_name_8723( $template, $type, $templates ){
	// filter...

	return $template;
}
$template(string)
Path to the template. See locate_template().
$type(string)
Filename without extension.
$templates(array)
A list of template candidates, in descending order of priority.

Notes

  • Since 4.8.0 The $type and $templates parameters were added.

Where the hook is called

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

Where the hook is used (in WP core)

wp-includes/customize/class-wp-customize-header-image-control.php 80
add_action( 'customize_controls_print_footer_scripts', array( $this, 'print_header_image_template' ) );
wp-includes/class-wp-customize-nav-menus.php 65
add_action( 'customize_controls_print_footer_scripts', array( $this, 'available_items_template' ) );
wp-includes/class-wp-customize-manager.php 674
add_filter( 'template', array( $this, 'get_template' ) );
wp-includes/class-wp-customize-manager.php 680
add_filter( 'pre_option_template', array( $this, 'get_template' ) );
wp-includes/class-wp-customize-manager.php 712
remove_filter( 'template', array( $this, 'get_template' ) );
wp-includes/class-wp-customize-manager.php 718
remove_filter( 'pre_option_template', array( $this, 'get_template' ) );