diff --git a/lib/class-wp-rest-term-search-handler.php b/lib/class-wp-rest-term-search-handler.php index 670eeb77e9fa32..b017a103234cdb 100644 --- a/lib/class-wp-rest-term-search-handler.php +++ b/lib/class-wp-rest-term-search-handler.php @@ -62,6 +62,7 @@ public function search_items( WP_REST_Request $request ) { array( 'taxonomy' => $taxonomies, 'name__like' => $term_search, + 'hide_empty' => false, ) ); diff --git a/phpunit/class-wp-rest-term-search-handler-test.php b/phpunit/class-wp-rest-term-search-handler-test.php index 13a7770d6bf5ac..16dc8258f6ae6d 100644 --- a/phpunit/class-wp-rest-term-search-handler-test.php +++ b/phpunit/class-wp-rest-term-search-handler-test.php @@ -77,6 +77,7 @@ public function test_get_items_search_type_term() { $this->assertEquals( 200, $response->get_status() ); $this->assertEqualSets( array( + 0 => 1, // that is the default category self::$my_category, self::$my_tag, ), @@ -99,6 +100,7 @@ public function test_get_items_search_type_term_subtype_category() { $this->assertEquals( 200, $response->get_status() ); $this->assertEqualSets( array( + 0 => 1, // that is the default category self::$my_category, ), wp_list_pluck( $response->get_data(), 'id' ) @@ -134,6 +136,7 @@ public function test_get_items_search_categories_and_tags() { $this->assertEquals( 200, $response->get_status() ); $this->assertEqualSets( array( + 0 => 1, // this is the default category self::$my_category, self::$my_tag, ),