post_class_taxonomies
Filters the taxonomies to generate classes for each individual term.
Default is all public taxonomies registered to the post type.
Usage
add_filter( 'post_class_taxonomies', 'wp_kama_post_class_taxonomies_filter', 10, 4 ); /** * Function for `post_class_taxonomies` filter-hook. * * @param string[] $taxonomies List of all taxonomy names to generate classes for. * @param int $post_id The post ID. * @param string[] $classes An array of post class names. * @param string[] $css_class An array of additional class names added to the post. * * @return string[] */ function wp_kama_post_class_taxonomies_filter( $taxonomies, $post_id, $classes, $css_class ){ // filter... return $taxonomies; }
- $taxonomies(string[])
- List of all taxonomy names to generate classes for.
- $post_id(int)
- The post ID.
- $classes(string[])
- An array of post class names.
- $css_class(string[])
- An array of additional class names added to the post.
Changelog
Since 6.1.0 | Introduced. |
Where the hook is called
post_class_taxonomies
wp-includes/post-template.php 572
$taxonomies = apply_filters( 'post_class_taxonomies', $taxonomies, $post->ID, $classes, $css_class );