- Timestamp:
- 10/31/2021 11:15:10 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
r51786 r51962 49 49 public function __construct( $post_type ) { 50 50 $this->post_type = $post_type; 51 $this->namespace = 'wp/v2';52 51 $obj = get_post_type_object( $post_type ); 53 52 $this->rest_base = ! empty( $obj->rest_base ) ? $obj->rest_base : $obj->name; 53 $this->namespace = ! empty( $obj->rest_namespace ) ? $obj->rest_namespace : 'wp/v2'; 54 54 55 55 $this->meta = new WP_REST_Post_Meta_Fields( $this->post_type ); … … 2038 2038 $featured_media = get_post_thumbnail_id( $post->ID ); 2039 2039 if ( $featured_media ) { 2040 $image_url = rest_url( 'wp/v2/media/' . $featured_media);2040 $image_url = rest_url( rest_get_route_for_post( $featured_media ) ); 2041 2041 2042 2042 $links['https://api.w.org/featuredmedia'] = array( … … 2047 2047 2048 2048 if ( ! in_array( $post->post_type, array( 'attachment', 'nav_menu_item', 'revision' ), true ) ) { 2049 $attachments_url = rest_url( 'wp/v2/media');2049 $attachments_url = rest_url( rest_get_route_for_post_type_items( 'attachment' ) ); 2050 2050 $attachments_url = add_query_arg( 'parent', $post->ID, $attachments_url ); 2051 2051
Note: See TracChangeset
for help on using the changeset viewer.