public function count( $args, $assoc_args ) {
		$post_id = Utils\get_flag_value( $args, 0, 0 );

		$count = wp_count_comments( $post_id );

		// Move total_comments to the end of the object
		$total = $count->total_comments;
		unset( $count->total_comments );
		$count->total_comments = $total;

		foreach ( $count as $status => $count ) {
			WP_CLI::line( str_pad( "$status:", 17 ) . $count );
		}
	}
public function count( $args, $assoc_args ) {
		$post_id = Utils\get_flag_value( $args, 0, 0 );

		$count = wp_count_comments( $post_id );

		// Move total_comments to the end of the object
		$total = $count->total_comments;
		unset( $count->total_comments );
		$count->total_comments = $total;

		foreach ( $count as $status => $count ) {
			WP_CLI::line( str_pad( "$status:", 17 ) . $count );
		}
	}
public function count ( $ args , $ assoc_args ) { $ post_id = Utils \ get_flag_value ( $ args , 0 , 0 ) ; $ count = wp_count_comments ( $ post_id ) ; // Move total_comments to the end of the object $ total = $ count -> total_comments ; unset ( $ count -> total_comments ) ; $ count -> total_comments = $ total ; foreach ( $ count as $ status => $ count ) { WP_CLI :: line ( str_pad ( "$status:" , 17 ) . $ count ) ; } }
Counts comments, on whole blog or on a given post.

## OPTIONS

[<post-id>]
: The ID of the post to count comments in.

## EXAMPLES

# Count comments on whole blog.
$ wp comment count
approved:        33
spam:            3
trash:           1
post-trashed:    0
all:             34
moderated:       1
total_comments:  37

# Count comments in a post.
$ wp comment count 42
approved:        19
spam:            0
trash:           0
post-trashed:    0
all:             19
moderated:       0
total_comments:  19
Counts comments on whole blog or on a given post .