rest_envelope_response
Filters the enveloped form of a REST API response.
Usage
add_filter( 'rest_envelope_response', 'wp_kama_rest_envelope_response_filter', 10, 2 ); /** * Function for `rest_envelope_response` filter-hook. * * @param array $envelope Envelope data. * @param WP_REST_Response $response Original response data. * * @return array */ function wp_kama_rest_envelope_response_filter( $envelope, $response ){ // filter... return $envelope; }
- $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.
Changelog
Since 4.4.0 | Introduced. |
Where the hook is called
rest_envelope_response
wp-includes/rest-api/class-wp-rest-server.php 819
$envelope = apply_filters( 'rest_envelope_response', $envelope, $response );