WordPress.org

Make WordPress Core

Changeset 52363


Ignore:
Timestamp:
12/13/2021 03:19:01 PM (5 weeks ago)
Author:
spacedmonkey
Message:

REST API: Ensure that the parent link, uses the rest_get_route_for_post function.

In [51962] the rest_get_route_for_post function was implemented in all places where link to a post's REST API endpoint is needed. However in this commit, the up link, which links to the parent post of the current object, did not use this function.

Props Spacedmonkey, SergeyBiryukov.
Fixes #53656.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    r52079 r52363  
    20402040        if ( $post_type_obj->hierarchical && ! empty( $post->post_parent ) ) {
    20412041            $links['up'] = array(
    2042                 'href'       => rest_url( trailingslashit( $base ) . (int) $post->post_parent ),
     2042                'href'       => rest_url( rest_get_route_for_post( $post->post_parent ) ),
    20432043                'embeddable' => true,
    20442044            );
Note: See TracChangeset for help on using the changeset viewer.