From 7bf191b16188551ff2f7ec82c94509772f7ebe8c Mon Sep 17 00:00:00 2001 From: Aki Hamano Date: Sun, 4 Jan 2026 20:05:29 +0900 Subject: [PATCH 1/9] Explicitly exclude note comment type on the comments table --- .../includes/class-wp-comments-list-table.php | 1 + .../tests/admin/wpCommentsListTable.php | 22 ++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/includes/class-wp-comments-list-table.php b/src/wp-admin/includes/class-wp-comments-list-table.php index 29343f78a0f6d..4903d8678faf9 100644 --- a/src/wp-admin/includes/class-wp-comments-list-table.php +++ b/src/wp-admin/includes/class-wp-comments-list-table.php @@ -151,6 +151,7 @@ public function prepare_items() { 'number' => $number, 'post_id' => $post_id, 'type' => $comment_type, + 'type__not_in' => array( 'note' ), 'orderby' => $orderby, 'order' => $order, 'post_type' => $post_type, diff --git a/tests/phpunit/tests/admin/wpCommentsListTable.php b/tests/phpunit/tests/admin/wpCommentsListTable.php index ed1d3a83bfb38..d3f71808d830b 100644 --- a/tests/phpunit/tests/admin/wpCommentsListTable.php +++ b/tests/phpunit/tests/admin/wpCommentsListTable.php @@ -218,8 +218,13 @@ public function test_get_views_should_return_views_by_default() { * Verify that the comments table never shows the note comment_type. * * @ticket 64198 + * @ticket 64474 + * + * @dataProvider data_comment_type + * + * @param string[] $comment_type The comment_type parameter value to test. */ - public function test_comments_list_table_does_not_show_note_comment_type() { + public function test_comments_list_table_does_not_show_note_comment_type( $comment_type ) { $post_id = self::factory()->post->create(); $note_id = self::factory()->comment->create( array( @@ -237,11 +242,22 @@ public function test_comments_list_table_does_not_show_note_comment_type() { 'comment_approved' => '1', ) ); - // Request the note comment type. - $_REQUEST['comment_type'] = 'note'; + $_REQUEST['comment_type'] = $comment_type; $this->table->prepare_items(); $items = $this->table->items; $this->assertCount( 1, $items ); $this->assertEquals( $comment_id, $items[0]->comment_ID ); } + + /** + * Data provider for test_comments_list_table_does_not_show_note_comment_type(). + * + * @return string[] + */ + public function data_comment_type() { + return array( + 'note type explicitly requested' => array( 'note' ), + 'all type requested' => array( 'all' ), + ); + } } From f9616f3ad29349962f2b4d2a617404ef0165a61c Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Mon, 5 Jan 2026 14:41:42 +0900 Subject: [PATCH 2/9] Fix return type Co-authored-by: Weston Ruter --- tests/phpunit/tests/admin/wpCommentsListTable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/tests/admin/wpCommentsListTable.php b/tests/phpunit/tests/admin/wpCommentsListTable.php index d3f71808d830b..8718f34a7e174 100644 --- a/tests/phpunit/tests/admin/wpCommentsListTable.php +++ b/tests/phpunit/tests/admin/wpCommentsListTable.php @@ -252,7 +252,7 @@ public function test_comments_list_table_does_not_show_note_comment_type( $comme /** * Data provider for test_comments_list_table_does_not_show_note_comment_type(). * - * @return string[] + * @return array */ public function data_comment_type() { return array( From 3d783d5e339dfca4a9b6d081e2f56977295a4ffb Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Mon, 5 Jan 2026 14:41:59 +0900 Subject: [PATCH 3/9] Remove spaces Co-authored-by: Mukesh Panchal --- tests/phpunit/tests/admin/wpCommentsListTable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/tests/admin/wpCommentsListTable.php b/tests/phpunit/tests/admin/wpCommentsListTable.php index 8718f34a7e174..bc7b75567a941 100644 --- a/tests/phpunit/tests/admin/wpCommentsListTable.php +++ b/tests/phpunit/tests/admin/wpCommentsListTable.php @@ -222,7 +222,7 @@ public function test_get_views_should_return_views_by_default() { * * @dataProvider data_comment_type * - * @param string[] $comment_type The comment_type parameter value to test. + * @param string[] $comment_type The comment_type parameter value to test. */ public function test_comments_list_table_does_not_show_note_comment_type( $comment_type ) { $post_id = self::factory()->post->create(); From 3abbeb34fd51d3093547c7b4ff9db633c8bad7f6 Mon Sep 17 00:00:00 2001 From: Aki Hamano Date: Mon, 5 Jan 2026 14:52:15 +0900 Subject: [PATCH 4/9] Fix PHPCS error --- tests/phpunit/tests/admin/wpCommentsListTable.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/tests/admin/wpCommentsListTable.php b/tests/phpunit/tests/admin/wpCommentsListTable.php index bc7b75567a941..df98b9b649684 100644 --- a/tests/phpunit/tests/admin/wpCommentsListTable.php +++ b/tests/phpunit/tests/admin/wpCommentsListTable.php @@ -225,8 +225,8 @@ public function test_get_views_should_return_views_by_default() { * @param string[] $comment_type The comment_type parameter value to test. */ public function test_comments_list_table_does_not_show_note_comment_type( $comment_type ) { - $post_id = self::factory()->post->create(); - $note_id = self::factory()->comment->create( + $post_id = self::factory()->post->create(); + $note_id = self::factory()->comment->create( array( 'comment_post_ID' => $post_id, 'comment_content' => 'This is a note.', @@ -234,7 +234,7 @@ public function test_comments_list_table_does_not_show_note_comment_type( $comme 'comment_approved' => '1', ) ); - $comment_id = self::factory()->comment->create( + $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => $post_id, 'comment_content' => 'This is a regular comment.', From de92b075c3b0b87ed67c87711e846b595cb2c174 Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Mon, 5 Jan 2026 15:41:07 +0900 Subject: [PATCH 5/9] Type the return value Co-authored-by: Weston Ruter --- tests/phpunit/tests/admin/wpCommentsListTable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/tests/admin/wpCommentsListTable.php b/tests/phpunit/tests/admin/wpCommentsListTable.php index df98b9b649684..fce19a93ed057 100644 --- a/tests/phpunit/tests/admin/wpCommentsListTable.php +++ b/tests/phpunit/tests/admin/wpCommentsListTable.php @@ -254,7 +254,7 @@ public function test_comments_list_table_does_not_show_note_comment_type( $comme * * @return array */ - public function data_comment_type() { + public function data_comment_type(): array { return array( 'note type explicitly requested' => array( 'note' ), 'all type requested' => array( 'all' ), From 41e0a93d9198f53adbadcb0e06e01f6966bbbded Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Mon, 5 Jan 2026 15:41:34 +0900 Subject: [PATCH 6/9] Type the argument Co-authored-by: Weston Ruter --- tests/phpunit/tests/admin/wpCommentsListTable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/tests/admin/wpCommentsListTable.php b/tests/phpunit/tests/admin/wpCommentsListTable.php index fce19a93ed057..cb7bbec6ba44c 100644 --- a/tests/phpunit/tests/admin/wpCommentsListTable.php +++ b/tests/phpunit/tests/admin/wpCommentsListTable.php @@ -224,7 +224,7 @@ public function test_get_views_should_return_views_by_default() { * * @param string[] $comment_type The comment_type parameter value to test. */ - public function test_comments_list_table_does_not_show_note_comment_type( $comment_type ) { + public function test_comments_list_table_does_not_show_note_comment_type( string $comment_type ) { $post_id = self::factory()->post->create(); $note_id = self::factory()->comment->create( array( From 5d71240f517ca77e9df907f29872731ef8293e28 Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Mon, 5 Jan 2026 15:41:56 +0900 Subject: [PATCH 7/9] Fix incorrect param type Co-authored-by: Weston Ruter --- tests/phpunit/tests/admin/wpCommentsListTable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/tests/admin/wpCommentsListTable.php b/tests/phpunit/tests/admin/wpCommentsListTable.php index cb7bbec6ba44c..34bba9bf0243a 100644 --- a/tests/phpunit/tests/admin/wpCommentsListTable.php +++ b/tests/phpunit/tests/admin/wpCommentsListTable.php @@ -222,7 +222,7 @@ public function test_get_views_should_return_views_by_default() { * * @dataProvider data_comment_type * - * @param string[] $comment_type The comment_type parameter value to test. + * @param string $comment_type The comment_type parameter value to test. */ public function test_comments_list_table_does_not_show_note_comment_type( string $comment_type ) { $post_id = self::factory()->post->create(); From 0f409690f20ddf1e43f87880c7e0cb807b119e0c Mon Sep 17 00:00:00 2001 From: Aki Hamano Date: Mon, 5 Jan 2026 15:45:01 +0900 Subject: [PATCH 8/9] Remove unused variable --- tests/phpunit/tests/admin/wpCommentsListTable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/tests/admin/wpCommentsListTable.php b/tests/phpunit/tests/admin/wpCommentsListTable.php index 34bba9bf0243a..3893ac8523306 100644 --- a/tests/phpunit/tests/admin/wpCommentsListTable.php +++ b/tests/phpunit/tests/admin/wpCommentsListTable.php @@ -226,7 +226,7 @@ public function test_get_views_should_return_views_by_default() { */ public function test_comments_list_table_does_not_show_note_comment_type( string $comment_type ) { $post_id = self::factory()->post->create(); - $note_id = self::factory()->comment->create( + self::factory()->comment->create( array( 'comment_post_ID' => $post_id, 'comment_content' => 'This is a note.', From 8578206041927bf92649a8a88f59fff221e3d18e Mon Sep 17 00:00:00 2001 From: Aki Hamano Date: Mon, 5 Jan 2026 15:56:06 +0900 Subject: [PATCH 9/9] Fix PHPCS error --- tests/phpunit/tests/admin/wpCommentsListTable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/tests/admin/wpCommentsListTable.php b/tests/phpunit/tests/admin/wpCommentsListTable.php index 3893ac8523306..20c2c1986f79c 100644 --- a/tests/phpunit/tests/admin/wpCommentsListTable.php +++ b/tests/phpunit/tests/admin/wpCommentsListTable.php @@ -225,7 +225,7 @@ public function test_get_views_should_return_views_by_default() { * @param string $comment_type The comment_type parameter value to test. */ public function test_comments_list_table_does_not_show_note_comment_type( string $comment_type ) { - $post_id = self::factory()->post->create(); + $post_id = self::factory()->post->create(); self::factory()->comment->create( array( 'comment_post_ID' => $post_id,