diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php index 6f2aeee670..358bad836a 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php @@ -146,6 +146,8 @@ class WP_REST_Post_Types_Controller extends WP_REST_Controller { * @return WP_REST_Response Response object. */ public function prepare_item_for_response( $post_type, $request ) { + $taxonomies = wp_list_filter( get_object_taxonomies( $post_type->name, 'objects' ), array( 'show_in_rest' => true ) ); + $taxonomies = wp_list_pluck( $taxonomies, 'name' ); $data = array( 'capabilities' => $post_type->cap, 'description' => $post_type->description, @@ -153,6 +155,7 @@ class WP_REST_Post_Types_Controller extends WP_REST_Controller { 'labels' => $post_type->labels, 'name' => $post_type->label, 'slug' => $post_type->name, + 'taxonomies' => array_values( $taxonomies ), ); $context = ! empty( $request['context'] ) ? $request['context'] : 'view'; $data = $this->add_additional_fields_to_object( $data, $request ); @@ -203,6 +206,9 @@ class WP_REST_Post_Types_Controller extends WP_REST_Controller { 'capabilities' => array( 'description' => __( 'All capabilities used by the resource.' ), 'type' => 'array', + 'items' => array( + 'type' => 'string', + ), 'context' => array( 'edit' ), 'readonly' => true, ), @@ -236,6 +242,15 @@ class WP_REST_Post_Types_Controller extends WP_REST_Controller { 'context' => array( 'view', 'edit', 'embed' ), 'readonly' => true, ), + 'taxonomies' => array( + 'description' => __( 'Taxonomies associated with resource.' ), + 'type' => 'array', + 'items' => array( + 'type' => 'string', + ), + 'context' => array( 'view', 'edit' ), + 'readonly' => true, + ), ), ); return $this->add_additional_fields_schema( $schema ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 52da207853..6383ba72bc 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-beta1-39096'; +$wp_version = '4.7-beta1-39097'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.