Update comment meta for all comments of specific post

Questions says it pretty much … Is it possible to change the comment meta for all comments of a specific post?

I know it probably works like this:

$comments = get_comments( array(

    'post_id' => $post->ID,

) );

foreach( $comments as $comment ) {

    update_comment_meta( $comment->comment_ID, 'accepted', '0' );

}

But is there a more elegant approach?

Read more here: Update comment meta for all comments of specific post

Leave a Reply

Your email address will not be published. Required fields are marked *