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       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(строка)
The comment ID as a numeric string.
$comment(WP_Comment)
The comment object.
$post(int|WP_Post)
The post ID or WP_Post object.

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

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

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

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

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

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