Skip to content

Commit

Permalink
Fix comment recount output
Browse files Browse the repository at this point in the history
  • Loading branch information
ernilambar committed Feb 14, 2024
1 parent a9761dc commit 9be7d88
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Comment_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -672,12 +672,12 @@ public function count( $args, $assoc_args ) {
*/
public function recount( $args ) {
foreach ( $args as $id ) {
wp_update_comment_count( $id );
$post = get_post( $id );
if ( $post ) {
wp_update_comment_count( $id );
WP_CLI::log( "Updated post {$post->ID} comment count to {$post->comment_count}." );
} else {
WP_CLI::warning( "Post {$post->ID} doesn't exist." );
WP_CLI::warning( "Post {$id} doesn't exist." );
}
}
}
Expand Down

0 comments on commit 9be7d88

Please sign in to comment.