Filter hook 'the_category'

in WP Core File wp-includes/category-template.php at line 230

View Source

the_category

Filter Hook
Description
Filters the category or list of categories.

Hook Information

File Location wp-includes/category-template.php View on GitHub
Hook Type Filter
Line Number 230

Hook Parameters

Type Name Description
string $thelist List of categories for the current post.
string $separator Separator used between the categories.
string $parents How to display the category parents. Accepts 'multiple', 'single', or empty.

Usage Examples

Basic Usage
<?php
// Hook into the_category
add_filter('the_category', 'my_custom_filter', 10, 3);

function my_custom_filter($thelist, $separator, $parents) {
    // Your custom filtering logic here
    return $thelist;
}

Source Code Context

wp-includes/category-template.php:230 - How this hook is used in WordPress core
<?php
 225  	 * @param string $thelist   List of categories for the current post.
 226  	 * @param string $separator Separator used between the categories.
 227  	 * @param string $parents   How to display the category parents. Accepts 'multiple',
 228  	 *                          'single', or empty.
 229  	 */
 230  	return apply_filters( 'the_category', $thelist, $separator, $parents );
 231  }
 232  
 233  /**
 234   * Checks if the current post is within any of the given categories.
 235   *

PHP Documentation

<?php
/**
	 * Filters the category or list of categories.
	 *
	 * @since 1.2.0
	 *
	 * @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.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/category-template.php
Related Hooks

Related hooks will be displayed here in future updates.