WordPress.org

Make WordPress Core

Ticket #38964: 38964.diff

File 38964.diff, 1001 bytes (added by jnylen0, 3 years ago)
  • src/wp-includes/rest-api/class-wp-rest-server.php

    diff --git a/src/wp-includes/rest-api/class-wp-rest-server.php b/src/wp-includes/rest-api/class-wp-rest-server.php
    index 11b8897..31582a5 100644
    a b class WP_REST_Server { 
    387387                        // Embed links inside the request.
    388388                        $result = $this->response_to_data( $result, isset( $_GET['_embed'] ) );
    389389
     390                        /**
     391                         * Filters the API response.
     392                         *
     393                         * Allows modification of the response after inserting embedded data, if any.
     394                         *
     395                         * @since 4.8.1
     396                         *
     397                         * @param WP_HTTP_Response $result  Result to send to the client. Usually a WP_REST_Response.
     398                         * @param WP_REST_Server   $this    Server instance.
     399                         * @param WP_REST_Request  $request Request used to generate the response.
     400                         */
     401                        $result = apply_filters( 'rest_post_embed', $result, $this, $request );
     402
    390403                        $result = wp_json_encode( $result );
    391404
    392405                        $json_error_message = $this->get_json_last_error();