Changeset 39191 for trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php
- Timestamp:
- 11/10/2016 02:20:09 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php
r39106 r39191 149 149 $taxonomies = wp_list_filter( get_object_taxonomies( $post_type->name, 'objects' ), array( 'show_in_rest' => true ) ); 150 150 $taxonomies = wp_list_pluck( $taxonomies, 'name' ); 151 $base = ! empty( $post_type->rest_base ) ? $post_type->rest_base : $post_type->name; 151 152 $data = array( 152 153 'capabilities' => $post_type->cap, … … 157 158 'slug' => $post_type->name, 158 159 'taxonomies' => array_values( $taxonomies ), 160 'rest_base' => $base, 159 161 ); 160 162 $context = ! empty( $request['context'] ) ? $request['context'] : 'view'; … … 164 166 // Wrap the data in a response object. 165 167 $response = rest_ensure_response( $data ); 166 167 $base = ! empty( $post_type->rest_base ) ? $post_type->rest_base : $post_type->name;168 168 169 169 $response->add_links( array( … … 252 252 'readonly' => true, 253 253 ), 254 'rest_base' => array( 255 'description' => __( 'REST base route for the resource.' ), 256 'type' => 'string', 257 'context' => array( 'view', 'edit', 'embed' ), 258 'readonly' => true, 259 ), 254 260 ), 255 261 );
Note: See TracChangeset
for help on using the changeset viewer.