the_category_list
Filters the categories before building the category list.
Использование
add_filter( 'the_category_list', 'wp_kama_the_category_list_filter', 10, 2 );
/**
* Function for `the_category_list` filter-hook.
*
* @param WP_Term[] $categories An array of the post's categories.
* @param int|false $post_id ID of the post to retrieve categories for. When `false`.
*
* @return WP_Term[]
*/
function wp_kama_the_category_list_filter( $categories, $post_id ){
// filter...
return $categories;
}
- $categories(WP_Term[])
- An array of the post's categories.
- $post_id(int|false)
- ID of the post to retrieve categories for. When false.
По умолчанию: current post in the loop
Список изменений
| С версии 4.4.0 | Введена. |
Где вызывается хук
the_category_list
wp-includes/category-template.php 158
$categories = apply_filters( 'the_category_list', get_the_category( $post_id ), $post_id );