the_category( string $separator = '', string $parents = '', int|false $post_id = false )
- Since
- 0.71
- Source
wp-includes/category-template.php:276
Displays category list for a post in either HTML list or custom format.
Parameters
$separatorstringoptional- Separator between the categories. By default, the links are placed in an unordered list. An empty string will result in the default behavior.Default:
'' $parentsstringoptional- How to display the parents. Accepts 'multiple', 'single', or empty. Default empty string.Default:
'' $post_idint|falseoptional- ID of the post to retrieve categories for. Defaults to the current post.Default:
false
Uses · 1
- get_the_category_list()Retrieves category list for a post in either HTML list or custom format.
Used by · 1
- twentytwenty_get_post_meta()Retrieves the post meta.
Source
function the_category( $separator = '', $parents = '', $post_id = false ) { echo get_the_category_list( $separator, $parents, $post_id );}History
Introduced in 0.71. One change between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
6.9.7
Parameter
$post_id retyped from int to int|false.verified against source0.71
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, from
src/wp-includes/category-template.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.