mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 21:08:44 +01:00
REST API: Only include the controller's own taxonomy in it's schema.
Previously, all taxonomies were incorrectly exposed as possible values. This commit brings the changes from [49922] to the 5.6 branch. Props johnbillion, TimothyBlynJacobs. Fixes #51940. git-svn-id: https://develop.svn.wordpress.org/branches/5.6@50047 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
95634ef0f4
commit
3bf49fdece
@ -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,
|
||||
),
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user