Default: empty stringNote: Default is a link to the child category, with no relationship exhibited.

$post_id

(int) (optional) Post ID to retrieve categories. The default value false results in the category list of the current post.

Default: false

Examples

Separated by Space

List categories with a space as the separator.
<?php the_category(' '); ?>

Separated by Comma

Displays links to categories, each category separated by a comma (if more than one).
<?php the_category(', '); ?>

Separated by Arrow

Displays links to categories with an arrow (>) separating the categories.
Note: Take care when using this, since some viewers may interpret a category following a > as a subcategory of the one preceding it.
<?php the_category('&gt; '); ?>