Make WordPress Core


Ignore:
Timestamp:
09/11/2022 06:53:28 PM (20 months ago)
Author:
TimothyBlynJacobs
Message:

REST API: Use helper functions for building routes in more places.

Props get_dave, spacedmonkey.
Fixes #56472.

File:
1 edited

Legend:

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

    r51962 r54121  
    335335
    336336        $request_params = $request->get_query_params();
    337         $base           = add_query_arg( urlencode_deep( $request_params ), rest_url( sprintf( '%s/%s/%d/%s', $this->namespace, $this->parent_base, $request['parent'], $this->rest_base ) ) );
     337        $base_path      = rest_url( sprintf( '%s/%s/%d/%s', $this->namespace, $this->parent_base, $request['parent'], $this->rest_base ) );
     338        $base           = add_query_arg( urlencode_deep( $request_params ), $base_path );
    338339
    339340        if ( $page > 1 ) {
     
    621622
    622623        if ( ! empty( $data['parent'] ) ) {
    623             $response->add_link( 'parent', rest_url( sprintf( '%s/%s/%d', $this->namespace, $this->parent_base, $data['parent'] ) ) );
     624            $response->add_link( 'parent', rest_url( rest_get_route_for_post( $data['parent'] ) ) );
    624625        }
    625626
Note: See TracChangeset for help on using the changeset viewer.