diff --git a/src/wp-includes/class-wp-comment-query.php b/src/wp-includes/class-wp-comment-query.php index 71cd525833..df1bbaf2ef 100644 --- a/src/wp-includes/class-wp-comment-query.php +++ b/src/wp-includes/class-wp-comment-query.php @@ -273,6 +273,8 @@ class WP_Comment_Query { 'orderby' => '', 'order' => 'DESC', 'parent' => '', + 'parent__in' => '', + 'parent__not_in' => '', 'post_author__in' => '', 'post_author__not_in' => '', 'post_ID' => '', diff --git a/tests/phpunit/tests/comment/query.php b/tests/phpunit/tests/comment/query.php index c717c83cb8..bda344cd95 100644 --- a/tests/phpunit/tests/comment/query.php +++ b/tests/phpunit/tests/comment/query.php @@ -1864,6 +1864,44 @@ class Tests_Comment_Query extends WP_UnitTestCase { $this->assertSame( $num_queries, $wpdb->num_queries ); } + /** + * @ticket 35677 + */ + public function test_cache_should_be_sensitive_to_parent__in() { + global $wpdb; + + $q1 = new WP_Comment_Query( array( + 'parent__in' => array( 1, 2, 3 ), + ) ); + + $num_queries = $wpdb->num_queries; + + $q2 = new WP_Comment_Query( array( + 'parent__in' => array( 4, 5, 6 ), + ) ); + + $this->assertNotEquals( $num_queries, $wpdb->num_queries ); + } + + /** + * @ticket 35677 + */ + public function test_cache_should_be_sensitive_to_parent__not_in() { + global $wpdb; + + $q1 = new WP_Comment_Query( array( + 'parent__not_in' => array( 1, 2, 3 ), + ) ); + + $num_queries = $wpdb->num_queries; + + $q2 = new WP_Comment_Query( array( + 'parent__not_in' => array( 4, 5, 6 ), + ) ); + + $this->assertNotEquals( $num_queries, $wpdb->num_queries ); + } + /** * @ticket 32762 */