Make WordPress Core


Ignore:
Timestamp:
09/11/2022 06:53:28 PM (2 years 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-templates-controller.php

    r53760 r54121  
    688688     */
    689689    protected function prepare_links( $id ) {
    690         $base = sprintf( '%s/%s', $this->namespace, $this->rest_base );
    691 
    692690        $links = array(
    693691            'self'       => array(
    694                 'href' => rest_url( trailingslashit( $base ) . $id ),
     692                'href' => rest_url( rest_get_route_for_post( $id ) ),
    695693            ),
    696694            'collection' => array(
    697                 'href' => rest_url( $base ),
     695                'href' => rest_url( rest_get_route_for_post_type_items( $this->post_type ) ),
    698696            ),
    699697            'about'      => array(
Note: See TracChangeset for help on using the changeset viewer.