diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php index d2aea69363..afb6054beb 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php @@ -965,7 +965,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller { 'taxonomy' => array( 'description' => __( 'Type attribution for the term.' ), 'type' => 'string', - 'enum' => array_keys( get_taxonomies() ), + 'enum' => array( $this->taxonomy ), 'context' => array( 'view', 'embed', 'edit' ), 'readonly' => true, ), diff --git a/tests/phpunit/tests/rest-api/rest-categories-controller.php b/tests/phpunit/tests/rest-api/rest-categories-controller.php index 99beabbc5e..5bd0d03a43 100644 --- a/tests/phpunit/tests/rest-api/rest-categories-controller.php +++ b/tests/phpunit/tests/rest-api/rest-categories-controller.php @@ -1140,7 +1140,7 @@ class WP_Test_REST_Categories_Controller extends WP_Test_REST_Controller_Testcas $this->assertArrayHasKey( 'parent', $properties ); $this->assertArrayHasKey( 'slug', $properties ); $this->assertArrayHasKey( 'taxonomy', $properties ); - $this->assertSame( array_keys( get_taxonomies() ), $properties['taxonomy']['enum'] ); + $this->assertSame( array( 'category' ), $properties['taxonomy']['enum'] ); } public function test_get_additional_field_registration() { diff --git a/tests/phpunit/tests/rest-api/rest-tags-controller.php b/tests/phpunit/tests/rest-api/rest-tags-controller.php index 72c2df455e..7d62f67282 100644 --- a/tests/phpunit/tests/rest-api/rest-tags-controller.php +++ b/tests/phpunit/tests/rest-api/rest-tags-controller.php @@ -1233,7 +1233,7 @@ class WP_Test_REST_Tags_Controller extends WP_Test_REST_Controller_Testcase { $this->assertArrayHasKey( 'name', $properties ); $this->assertArrayHasKey( 'slug', $properties ); $this->assertArrayHasKey( 'taxonomy', $properties ); - $this->assertSame( array_keys( get_taxonomies() ), $properties['taxonomy']['enum'] ); + $this->assertSame( array( 'post_tag' ), $properties['taxonomy']['enum'] ); } public function test_get_item_schema_non_hierarchical() {