comment_class хук-фильтрWP 2.7.0

Filters the returned CSS classes for the current comment.

Использование

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_id    The post ID or WP_Post object.
 *
 * @return string[]
 */
function wp_kama_comment_class_filter( $classes, $css_class, $comment_id, $comment, $post_id ){

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

Список изменений

С версии 2.7.0 Введена.

Где вызывается хук

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

Где используется хук в WordPress

Использование не найдено.