rest_envelope_response WordPress Filter Hook

The rest_envelope_response is a WordPress hook that allows you to modify the data that is returned in the JSON response from the REST API. This can be useful for adding extra data to the response or for changing the format of the data.

apply_filters( 'rest_envelope_response', array $envelope, WP_REST_Response $response ) #

Filters the enveloped form of a REST API response.


Parameters

$envelope

(array)Envelope data.

  • 'body'
    (array) Response data.
  • 'status'
    (int) The 3-digit HTTP status code.
  • 'headers'
    (array) Map of header name to header value.

$response

(WP_REST_Response)Original response data.


Top ↑

Source

File: wp-includes/rest-api/class-wp-rest-server.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
4.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.