comment_class WordPress Filter Hook

The comment_class hook is used to add CSS classes to comments. This can be useful for targeting specific comments with CSS, or for adding custom classes to comments.

apply_filters( 'comment_class', string[] $classes, string[] $css_class, string $comment_id, WP_Comment $comment, int|WP_Post $post_id ) #

Filters the returned CSS classes for the current comment.


Parameters

$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_id

(int|WP_Post)The post ID or WP_Post object.


Top ↑

Source

File: wp-includes/comment-template.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
2.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More