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:

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

Related Functions

get_the_category_rss, get_the_category_list, the_category, get_category, get_the_category_by_id

Top Google Results

User discussions

wpseek mobile