Make WordPress Core

Ticket #45189: 45189.2.diff

File 45189.2.diff, 1.6 KB (added by danielbachhuber, 6 years ago)
  • src/wp-includes/rest-api.php

    diff --git a/src/wp-includes/rest-api.php b/src/wp-includes/rest-api.php
    index f1892c10c4..9a64edd5d9 100644
    a b function rest_preload_api_request( $memo, $path ) { 
    13681368        if ( 200 === $response->status ) {
    13691369                $server = rest_get_server();
    13701370                $data   = (array) $response->get_data();
    1371                 if ( method_exists( $server, 'get_compact_response_links' ) ) {
    1372                         $links = call_user_func( array( $server, 'get_compact_response_links' ), $response );
    1373                 } else {
    1374                         $links = call_user_func( array( $server, 'get_response_links' ), $response );
    1375                 }
     1371                $links  = $server->get_compact_response_links( $response );
    13761372                if ( ! empty( $links ) ) {
    13771373                        $data['_links'] = $links;
    13781374                }
  • src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php

    diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php
    index 04bd1580f7..f98d1ad57e 100644
    a b abstract class WP_REST_Controller { 
    212212
    213213                $data   = (array) $response->get_data();
    214214                $server = rest_get_server();
    215 
    216                 if ( method_exists( $server, 'get_compact_response_links' ) ) {
    217                         $links = call_user_func( array( $server, 'get_compact_response_links' ), $response );
    218                 } else {
    219                         $links = call_user_func( array( $server, 'get_response_links' ), $response );
    220                 }
     215                $links  = $server->get_compact_response_links( $response );
    221216
    222217                if ( ! empty( $links ) ) {
    223218                        $data['_links'] = $links;