WordPress at a glance

the_category() WP 1.0

Display category list for a post in either HTML list or custom format.

Works based on: get_the_category_list()
✈ 1 time = 0.006019s = very slow | 50000 times = 16.46s = slow PHP 7.1.2, WP 4.7.3

No Hooks.

Return

Nothing (null).

Usage

the_category( $separator, $parents, $post_id );
$separator(string)
Separator between the categories. By default, the links are placed in an unordered list. An empty string will result in the default behavior.
Default: ''
$parents(string)
How to display the parents.
Default: ''
$post_id(int)
Post ID to retrieve categories.
Default: false

Code of the_category: wp-includes/category-template.php VER 4.9.8

<?php
function the_category( $separator = '', $parents = '', $post_id = false ) {
	echo get_the_category_list( $separator, $parents, $post_id );
}

Related Functions

From category: For posts

More from Template Tags: Posts, Pages, ...

No comments
    Hello, !     Log In . Register