the_category
Filters the category or list of categories.
Usage
add_filter( 'the_category', 'wp_kama_the_category_filter', 10, 3 ); /** * Function for `the_category` filter-hook. * * @param string $thelist List of categories for the current post. * @param string $separator Separator used between the categories. * @param string $parents How to display the category parents. Accepts 'multiple', 'single', or empty. * * @return string */ function wp_kama_the_category_filter( $thelist, $separator, $parents ){ // filter... return $thelist; }
- $thelist(string)
- List of categories for the current post.
- $separator(string)
- Separator used between the categories.
- $parents(string)
- How to display the category parents. Accepts 'multiple', 'single', or empty.
Changelog
Since 1.2.0 | Introduced. |
Where the hook is called
the_category
the_category
the_category
the_category
wp-includes/category-template.php 230
return apply_filters( 'the_category', $thelist, $separator, $parents );
wp-includes/category-template.php 146
return apply_filters( 'the_category', '', $separator, $parents );
wp-includes/category-template.php 162
return apply_filters( 'the_category', __( 'Uncategorized' ), $separator, $parents );
wp-admin/includes/class-walker-category-checklist.php 108
esc_html( apply_filters( 'the_category', $category->name, '', '' ) ) . '</div>';
wp-admin/includes/class-walker-category-checklist.php 118
esc_html( apply_filters( 'the_category', $category->name, '', '' ) ) . '</label>';
wp-admin/includes/template.php 250
echo esc_html( apply_filters( 'the_category', $term->name, '', '' ) );
wp-admin/includes/template.php 298
$name = esc_html( apply_filters( 'the_category', $category->name, '', '' ) );
wp-admin/edit-tags.php 630
'<strong>' . apply_filters( 'the_category', get_cat_name( get_option( 'default_category' ) ), '', '' ) . '</strong>'