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.




git-svn-id: https://develop.svn.wordpress.org/trunk@52363 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonny Harris 2021-12-13 15:19:01 +00:00
parent df8c3d0e08
commit 7155e3c083

View File

@ -2039,7 +2039,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
if ( $post_type_obj->hierarchical && ! empty( $post->post_parent ) ) {
$links['up'] = array(
'href' => rest_url( trailingslashit( $base ) . (int) $post->post_parent ),
'href' => rest_url( rest_get_route_for_post( $post->post_parent ) ),
'embeddable' => true,
);
}