diff --git a/wp-admin/includes/class-wp-comments-list-table.php b/wp-admin/includes/class-wp-comments-list-table.php index 82cc921ee3..c4d323cf89 100644 --- a/wp-admin/includes/class-wp-comments-list-table.php +++ b/wp-admin/includes/class-wp-comments-list-table.php @@ -151,7 +151,6 @@ class WP_Comments_List_Table extends WP_List_Table { 'order' => $order, 'post_type' => $post_type, 'update_comment_post_cache' => true, - 'type__not_in' => array( 'note' ), ); /** diff --git a/wp-admin/includes/comment.php b/wp-admin/includes/comment.php index d38ab9447c..ae5ba9d223 100644 --- a/wp-admin/includes/comment.php +++ b/wp-admin/includes/comment.php @@ -138,6 +138,7 @@ function get_comment_to_edit( $id ) { * Gets the number of pending comments on a post or posts. * * @since 2.3.0 + * @since 6.9.0 Exclude the 'note' comment type from the count. * * @global wpdb $wpdb WordPress database abstraction object. * diff --git a/wp-includes/class-wp-comment-query.php b/wp-includes/class-wp-comment-query.php index 6c813c7e1a..b2a9275c52 100644 --- a/wp-includes/class-wp-comment-query.php +++ b/wp-includes/class-wp-comment-query.php @@ -536,6 +536,7 @@ class WP_Comment_Query { * Used internally to get a list of comment IDs matching the query vars. * * @since 4.4.0 + * @since 6.9.0 Excludes the 'note' comment type, unless 'all' or the 'note' types are requested. * * @global wpdb $wpdb WordPress database abstraction object. * @@ -770,6 +771,15 @@ class WP_Comment_Query { 'NOT IN' => (array) $this->query_vars['type__not_in'], ); + // Exclude the 'note' comment type, unless 'all' types or the 'note' type explicitly are requested. + if ( + ! in_array( 'all', $raw_types['IN'], true ) && + ! in_array( 'note', $raw_types['IN'], true ) && + ! in_array( 'note', $raw_types['NOT IN'], true ) + ) { + $raw_types['NOT IN'][] = 'note'; + } + $comment_types = array(); foreach ( $raw_types as $operator => $_raw_types ) { $_raw_types = array_unique( $_raw_types ); diff --git a/wp-includes/comment.php b/wp-includes/comment.php index aa841bfda9..0b07d53d69 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -417,7 +417,6 @@ function get_comment_count( $post_id = 0 ) { 'count' => true, 'update_comment_meta_cache' => false, 'orderby' => 'none', - 'type__not_in' => array( 'note' ), ); if ( $post_id > 0 ) { $args['post_id'] = $post_id; diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php index f4f6bdd1f1..4ab82ff7f0 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php @@ -1254,6 +1254,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller { array( 'count' => true, 'orderby' => 'none', + 'type' => 'all', ) ); @@ -1270,6 +1271,22 @@ class WP_REST_Comments_Controller extends WP_REST_Controller { ); } + // Embedding children for notes requires `type` and `status` inheritance. + if ( isset( $links['children'] ) && 'note' === $comment->comment_type ) { + $args = array( + 'parent' => $comment->comment_ID, + 'type' => $comment->comment_type, + 'status' => 'all', + ); + + $rest_url = add_query_arg( $args, rest_url( $this->namespace . '/' . $this->rest_base ) ); + + $links['children'] = array( + 'href' => $rest_url, + 'embeddable' => true, + ); + } + return $links; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 8d0206d17a..06661c8919 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.9-beta2-61104'; +$wp_version = '6.9-beta2-61105'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.