get_the_categories filter-hook . WP 3.1.0
Filters the array of categories to return for a post.
Usage
add_filter( 'get_the_categories', 'filter_function_name_6487', 10, 2 ); function filter_function_name_6487( $categories, $post_id ){ // filter... return $categories; }
- $categories(WP_Term[])
- An array of categories to return for the post.
- $post_id(int/false)
- ID of the post.
Changelog
Since 3.1.0 | Introduced. |
Since 4.4.0 | Added $post_id parameter. |
Where the hook is called
get_the_categories
wp-includes/category-template.php 98
return apply_filters( 'get_the_categories', $categories, $post_id );