the_category

The timeline below displays how wordpress function the_category has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Displays category list for a post in either HTML list or custom format.
 *
 * @since 0.71
 *
 * @param string $separator Optional. Separator between the categories. By default, the links are placed
 *                          in an unordered list. An empty string will result in the default behavior.
 * @param string $parents   Optional. How to display the parents. Accepts 'multiple', 'single', or empty.
 *                          Default empty string.
 * @param int    $post_id   Optional. ID of the post to retrieve categories for. Defaults to the current post.
 */
function the_category($separator = '', $parents = '', $post_id = false)
{
    echo get_the_category_list($separator, $parents, $post_id);
}

WordPress Version: 5.5

/**
 * Displays category list for a post in either HTML list or custom format.
 *
 * @since 0.71
 *
 * @param string $separator Optional. Separator between the categories. By default, the links are placed
 *                          in an unordered list. An empty string will result in the default behavior.
 * @param string $parents   Optional. How to display the parents.
 * @param int    $post_id   Optional. Post ID to retrieve categories.
 */
function the_category($separator = '', $parents = '', $post_id = false)
{
    echo get_the_category_list($separator, $parents, $post_id);
}

WordPress Version: 4.8

/**
 * Display category list for a post in either HTML list or custom format.
 *
 * @since 0.71
 *
 * @param string $separator Optional. Separator between the categories. By default, the links are placed
 *                          in an unordered list. An empty string will result in the default behavior.
 * @param string $parents Optional. How to display the parents.
 * @param int $post_id Optional. Post ID to retrieve categories.
 */
function the_category($separator = '', $parents = '', $post_id = false)
{
    echo get_the_category_list($separator, $parents, $post_id);
}

WordPress Version: 3.7

/**
 * Display the category list for the post.
 *
 * @since 0.71
 *
 * @param string $separator Optional, default is empty string. Separator for between the categories.
 * @param string $parents Optional. How to display the parents.
 * @param int $post_id Optional. Post ID to retrieve categories.
 */
function the_category($separator = '', $parents = '', $post_id = false)
{
    echo get_the_category_list($separator, $parents, $post_id);
}