wp-includes/category-template.php:77Retrieves post categories.
$post_idintoptionalfalseWP_Term[]One hook fires while get_the_category() runs, in this order:
Filters the array of categories to return for a post.
function get_the_category( $post_id = false ) { $categories = get_the_terms( $post_id, 'category' ); if ( ! $categories || is_wp_error( $categories ) ) { $categories = array(); } $categories = array_values( $categories ); foreach ( array_keys( $categories ) as $key ) { _make_cat_compat( $categories[ $key ] ); } /** * Filters the array of categories to return for a post. * * @since 3.1.0 * @since 4.4.0 Added the `$post_id` parameter. * * @param WP_Term[] $categories An array of categories to return for the post. * @param int|false $post_id The post ID. */ return apply_filters( 'get_the_categories', $categories, $post_id );}Introduced in 0.71. One change between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
$post_id retyped from int to int|false.verified against sourcesrc/wp-includes/category-template.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.