Skip to content

Commit c7b54bc

Browse files
committed
Default comment_post_ID to 1 in generate() to avoid notices in old WPs.
1 parent b83abb9 commit c7b54bc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Comment_Command.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function update( $args, $assoc_args ) {
128128
* ---
129129
*
130130
* [--post_id=<post-id>]
131-
* : Assign comments to a specific post.
131+
* : Assign comments to a specific post. Defaults to post_id 1.
132132
*
133133
* [--format=<format>]
134134
* : Render output in a particular format.
@@ -167,7 +167,7 @@ public function generate( $args, $assoc_args ) {
167167
}
168168

169169
// Make sure comment_post_ID set for older WP versions else get undefined PHP notice.
170-
$comment_post_ID = isset( $assoc_args['post_id'] ) ? $assoc_args['post_id'] : 0;
170+
$comment_post_ID = isset( $assoc_args['post_id'] ) ? $assoc_args['post_id'] : 1;
171171

172172
$comment_count = wp_count_comments();
173173
$total = (int )$comment_count->total_comments;

0 commit comments

Comments
 (0)