comment_class filter-hookWP 2.7.0

Filters the returned CSS classes for the current comment.

Usage

add_filter( 'comment_class', 'wp_kama_comment_class_filter', 10, 5 );

/**
 * Function for `comment_class` filter-hook.
 * 
 * @param string[]    $classes    An array of comment classes.
 * @param string[]    $css_class  An array of additional classes added to the list.
 * @param string      $comment_id The comment ID as a numeric string.
 * @param WP_Comment  $comment    The comment object.
 * @param int|WP_Post $post       The post ID or WP_Post object.
 *
 * @return string[]
 */
function wp_kama_comment_class_filter( $classes, $css_class, $comment_id, $comment, $post ){

	// filter...
	return $classes;
}
$classes(string[])
An array of comment classes.
$css_class(string[])
An array of additional classes added to the list.
$comment_id(string)
The comment ID as a numeric string.
$comment(WP_Comment)
The comment object.
$post(int|WP_Post)
The post ID or WP_Post object.

Changelog

Since 2.7.0 Introduced.

Where the hook is called

get_comment_class()
comment_class
wp-includes/comment-template.php 539
return apply_filters( 'comment_class', $classes, $css_class, $comment->comment_ID, $comment, $post );

Where the hook is used in WordPress

Usage not found.