W3cubDocs

/WordPress

apply_filters( ‘get_the_categories’, WP_Term[] $categories, int|false $post_id )

Filters the array of categories to return for a post.

Parameters

$categoriesWP_Term[]
An array of categories to return for the post.
$post_idint|false
The post ID.

Source

return apply_filters( 'get_the_categories', $categories, $post_id );

Changelog

Version Description
4.4.0 Added the $post_id parameter.
3.1.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/get_the_categories