WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/29/2018 12:47:01 AM (3 years ago)
Author:
danielbachhuber
Message:

REST API: Improve performance by avoiding call_user_func().

The get_compact_response_links() method was introduced in WP 4.5, and this conditional is no longer necessary.

Props schlessera, timothyblynjacobs.
Fixes #45189.

File:
1 edited

Legend:

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

    r43833 r43834  
    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;
Note: See TracChangeset for help on using the changeset viewer.