attachment_template_hierarchy хук-фильтрWP 4.7.0

Filters the list of template filenames that are searched for when retrieving a template to use.

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

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

add_filter( 'attachment_template_hierarchy', 'wp_kama_attachment_template_hierarchy_filter' );

/**
 * Function for `attachment_template_hierarchy` filter-hook.
 * 
 * @param string[] $templates A list of template candidates, in descending order of priority.
 *
 * @return string[]
 */
function wp_kama_attachment_template_hierarchy_filter( $templates ){

	// filter...
	return $templates;
}
$templates(string[])
A list of template candidates, in descending order of priority.

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

С версии 4.7.0 Введена.

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

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

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

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