get_the_category
get_the_category ( $post_id = false )
Parameters:- (int) post_id Optional. The post ID. Defaults to current post ID.
Returns:- (WP_Term[]) Array of WP_Term objects, one for each category assigned to the post.
Defined at: - Introduced in WordPress: 0.71
- Deprecated in WordPress: —
Description
Retrieves post categories.This tag may be used outside The Loop by passing a post ID as the parameter.
Note: This function only returns results from the default "category" taxonomy.
For custom taxonomies use get_the_terms().