list_cats хук-фильтрWP 1.2.0

Filters a taxonomy drop-down display element.

A variety of taxonomy drop-down display elements can be modified just prior to display via this filter. Filterable arguments include 'show_option_none', 'show_option_all', and various forms of the term name.

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

add_filter( 'list_cats', 'wp_kama_list_cats_filter', 10, 2 );

/**
 * Function for `list_cats` filter-hook.
 * 
 * @param string       $element  Category name.
 * @param WP_Term|null $category The category object, or null if there's no corresponding category.
 *
 * @return string
 */
function wp_kama_list_cats_filter( $element, $category ){

	// filter...
	return $element;
}
$element(строка)
Category name.
$category(WP_Term|null)
The category object, or null if there's no corresponding category.

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

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

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

wp_dropdown_categories()
list_cats
Walker_CategoryDropdown::start_el()
list_cats
Walker_Category::start_el()
list_cats
wp-includes/category-template.php 437
$show_option_none = apply_filters( 'list_cats', $parsed_args['show_option_none'], null );
wp-includes/class-walker-category-dropdown.php 66
$cat_name = apply_filters( 'list_cats', $category->name, $category );
wp-includes/category-template.php 446
$show_option_all = apply_filters( 'list_cats', $parsed_args['show_option_all'], null );
wp-includes/category-template.php 454
$show_option_none = apply_filters( 'list_cats', $parsed_args['show_option_none'], null );
wp-includes/class-walker-category.php 106
$cat_name = apply_filters( 'list_cats', esc_attr( $category->name ), $category );

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

wp-includes/default-filters.php 224
add_filter( 'list_cats', 'wptexturize' );