search_template хук-фильтрWP 1.5.0

Filters the path of the queried template by type.

Это один из вариантов динамического хука (type)_template

Использование

add_filter( 'search_template', 'wp_kama_search_template_filter', 10, 3 );

/**
 * Function for `search_template` filter-hook.
 * 
 * @param string   $template  Path to the template. See locate_template().
 * @param string   $type      Sanitized filename without extension.
 * @param string[] $templates A list of template candidates, in descending order of priority.
 *
 * @return string
 */
function wp_kama_search_template_filter( $template, $type, $templates ){

	// filter...
	return $template;
}
$template(строка)
Path to the template. See locate_template().
$type(строка)
Sanitized filename without extension.
$templates(string[])
A list of template candidates, in descending order of priority.

Список изменений

С версии 1.5.0 Введена.
С версии 4.8.0 The $type and $templates parameters were added.

Где вызывается хук

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

Где используется хук в WordPress

Использование не найдено.