So not sure if i have missed something but awaiting comments dont have a own class, so is there a way to add in a simple way a custom class to comments that are awaiting moderation so that I can style there comments with CSS.
1 Answer
Here’s one way to add a custom .wpse-comment-awaiting-moderation
comment class through the comment_class
filter:
add_filter( 'comment_class', 'wpse_259326_comment_classes', 10, 5 );
function wpse_259326_comment_classes ( $classes, $class, $comment_ID, $comment, $post_id )
{
if( 'unapproved' === wp_get_comment_status( $comment ) && is_array( $classes ) )
$classes[] = 'wpse-comment-awaiting-moderation';
return $classes;
}
where we used that wp_get_comment_status( $comment )
returns 'unapproved'
for unappproved comments.