Skip to content

Commit 45e7347

Browse files
WP_Comment_Query: exclude the 'note' type, unless 'all' or 'note' type explicitly requested
1 parent 7a840d3 commit 45e7347

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

src/wp-admin/includes/class-wp-comments-list-table.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ public function prepare_items() {
151151
'order' => $order,
152152
'post_type' => $post_type,
153153
'update_comment_post_cache' => true,
154-
'type__not_in' => array( 'note' ),
155154
);
156155

157156
/**

src/wp-admin/includes/comment.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ function get_comment_to_edit( $id ) {
138138
* Gets the number of pending comments on a post or posts.
139139
*
140140
* @since 2.3.0
141+
* @since 6.9.0 Exclude the 'note' comment type from the count.
141142
*
142143
* @global wpdb $wpdb WordPress database abstraction object.
143144
*

src/wp-includes/class-wp-comment-query.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,11 @@ protected function get_comment_ids() {
770770
'NOT IN' => (array) $this->query_vars['type__not_in'],
771771
);
772772

773+
// @since 6.9.0 Exclude the 'note' comment type, unless 'all' types or the 'note' type explicitly are requested.
774+
if ( ! in_array( 'all', $raw_types['IN'], true ) && ! in_array( 'note', $raw_types['IN'], true ) ) {
775+
$raw_types['NOT IN'][] = 'note';
776+
}
777+
773778
$comment_types = array();
774779
foreach ( $raw_types as $operator => $_raw_types ) {
775780
$_raw_types = array_unique( $_raw_types );

src/wp-includes/comment.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,6 @@ function get_comment_count( $post_id = 0 ) {
417417
'count' => true,
418418
'update_comment_meta_cache' => false,
419419
'orderby' => 'none',
420-
'type__not_in' => array( 'note' ),
421420
);
422421
if ( $post_id > 0 ) {
423422
$args['post_id'] = $post_id;

0 commit comments

Comments
 (0)