From ab94b2f5ca79176e5ca0027c7c91094c5a9d6de6 Mon Sep 17 00:00:00 2001 From: Paul de Wouters <30460+pdewouters@users.noreply.github.com> Date: Wed, 12 Jul 2023 11:47:06 +0100 Subject: [PATCH] Update taxQuery.php --- tests/phpunit/tests/query/taxQuery.php | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/phpunit/tests/query/taxQuery.php b/tests/phpunit/tests/query/taxQuery.php index f517e4bb84134..271c1772b2311 100644 --- a/tests/phpunit/tests/query/taxQuery.php +++ b/tests/phpunit/tests/query/taxQuery.php @@ -1744,4 +1744,36 @@ public function test_hierarchical_taxonomies_do_not_limit_query() { $this->assertSameSets( array( $p ), $q->posts ); $this->assertStringNotContainsString( 'LIMIT 1', $query ); } + + /** + * @ticket 57300 + * + * @covers WP_Query::parse_tax_query + */ + public function test_rewrite_hierarchical_array_query_param() { + register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true, 'rewrite' => array( 'hierarchical' => true ) ) ); + $name = 'foobar'; + $t = self::factory()->term->create( + array( + 'taxonomy' => 'wptests_tax', + 'name' => $name, + ) + ); + + $q = new WP_Query( + array( + 'fields' => 'ids', + 'wptests_tax' => [$name], + 'tax_query' => array( + array( + 'taxonomy' => 'wptests_tax', + 'field' => 'name', + 'terms' => $name, + ), + ), + ) + ); + // If we got this far, no errors were thrown. + $this->expectNotToPerformAssertions(); + } }