Changeset 53721
- Timestamp:
- 07/19/2022 02:47:45 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php
r52831 r53721 245 245 $response = rest_ensure_response( $data ); 246 246 247 $response->add_links( 248 array( 249 'collection' => array( 250 'href' => rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ), 251 ), 252 'https://api.w.org/items' => array( 253 'href' => rest_url( rest_get_route_for_post_type_items( $post_type->name ) ), 254 ), 255 ) 256 ); 247 $response->add_links( $this->prepare_links( $post_type ) ); 257 248 258 249 /** … … 395 386 } 396 387 388 /** 389 * Prepares links for the request. 390 * 391 * @since 6.1.0 392 * 393 * @param WP_Post_Type $post_type The post type. 394 * @return array Links for the given post type. 395 */ 396 protected function prepare_links( $post_type ) { 397 return array( 398 'collection' => array( 399 'href' => rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ), 400 ), 401 'https://api.w.org/items' => array( 402 'href' => rest_url( rest_get_route_for_post_type_items( $post_type->name ) ), 403 ), 404 ); 405 } 397 406 }
Note: See TracChangeset
for help on using the changeset viewer.