Make WordPress Core


Ignore:
Timestamp:
01/23/2021 11:25:40 PM (12 months ago)
Author:
TimothyBlynJacobs
Message:

REST API: Support embedding links in rest_preload_api_request().

Props lpawlik, spacedmonkey.
Fixes #51722.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api.php

    r49611 r50005  
    25212521    if ( 200 === $response->status ) {
    25222522        $server = rest_get_server();
    2523         $data   = (array) $response->get_data();
    2524         $links  = $server::get_compact_response_links( $response );
    2525         if ( ! empty( $links ) ) {
    2526             $data['_links'] = $links;
    2527         }
     2523        $embed  = $request->has_param( '_embed' ) ? rest_parse_embed_param( $request['_embed'] ) : false;
     2524        $data   = (array) $server->response_to_data( $response, $embed );
    25282525
    25292526        if ( 'OPTIONS' === $method ) {
Note: See TracChangeset for help on using the changeset viewer.