the_category_list
Filters the categories before building the category list.
Usage
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.
Default: current post in the loop
Changelog
| Since 4.4.0 | Introduced. |
Where the hook is called
the_category_list
wp-includes/category-template.php 158
$categories = apply_filters( 'the_category_list', get_the_category( $post_id ), $post_id );