post_class filter-hookWP 2.7.0

Filters the list of CSS class names for the current post.

Usage

add_filter( 'post_class', 'wp_kama_post_class_filter', 10, 3 );

/**
 * Function for `post_class` filter-hook.
 * 
 * @param string[] $classes   An array of post class names.
 * @param string[] $css_class An array of additional class names added to the post.
 * @param int      $post_id   The post ID.
 *
 * @return string[]
 */
function wp_kama_post_class_filter( $classes, $css_class, $post_id ){

	// filter...
	return $classes;
}
$classes(string[])
An array of post class names.
$css_class(string[])
An array of additional class names added to the post.
$post_id(int)
The post ID.

Changelog

Since 2.7.0 Introduced.

Where the hook is called

get_post_class()
post_class
wp-includes/post-template.php 605
$classes = apply_filters( 'post_class', $classes, $css_class, $post->ID );

Where the hook is used in WordPress

Usage not found.