Function: get_the_category_list

get_the_category_list( string $separator, string $parents, integer $post_id )

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

Shortcut: gtcl

You can use above key combination to trigger the associated snippet for this function in the WordPress Snippets for Visual Studio Code extension. You can also use this shortcut to search for this function on this website.

Parameters

Name Type(s) Default Value Description
$separator string ''

Optional. Separator between the categories. By default, the links are placed in an unordered list. An empty string will result in the default behavior.

$parents string ''

Optional. How to display the parents.

$post_id integer false

Optional. Post ID to retrieve categories.

Returns

string

WordPress Developer Newsletter

Stay informed of new chapter releases, important WordPress API updates and more.