get_the_category( int $id = false )

Description #Description

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().

Parameters #Parameters


(int) (Optional) default to current post ID. The post ID.

Default value: false

Top ↑

Return #Return

(WP_Term[]) Array of WP_Term objects, one for each category assigned to the post.

Retrieve post categories.

Share :
Tag :