WPDev.one
Core Function
View Source on Trac ↗

get_the_category_list()

get_the_category_list( mixed $separator = '', mixed $parents = '', mixed $post_id = false )

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

Parameters 2 required

Name / Type Description
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.

Required
string

$parents Optional. How to display the parents. Accepts 'multiple', 'single', or empty. Default empty string.

Required
$post_id
int

Optional. ID of the post to retrieve categories for. Defaults to the current post.

Return Value

(string)
Category list for a post.

Function Information

Since Version
1.5.1
Source File
wp-includes/category-template.php
Advertisement