apply_filters( 'get_the_categories', WP_Term[] $categories , int|false $post_id )
Filters the array of categories to return for a post.
Parameters
-
$categories
WP_Term[] -
An array of categories to return for the post.
-
$post_id
int|false -
The post ID.
Source
File: wp-includes/category-template.php
.
View all references
return apply_filters( 'get_the_categories', $categories, $post_id );
Changelog
Version | Description |
---|---|
4.4.0 | Added the $post_id parameter. |
3.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
Remove certain categories from being display on post loop for a specific post.
Assume we want to remove categories with slug
cat-slug-a
andcat-slug-b
for post with ID5