Title: rest_pre_echo_response
Published: November 20, 2017
Last modified: May 20, 2026

---

# apply_filters( ‘rest_pre_echo_response’, array $result, WP_REST_Server $server, WP_REST_Request $request )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/rest_pre_echo_response/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/hooks/rest_pre_echo_response/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/rest_pre_echo_response/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/rest_pre_echo_response/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/rest_pre_echo_response/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/rest_pre_echo_response/?output_format=md#wp--skip-link--target)

Filters the REST API response.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/rest_pre_echo_response/?output_format=md#description)󠁿

Allows modification of the response data after inserting embedded data (if any) 
and before echoing the response data.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/rest_pre_echo_response/?output_format=md#parameters)󠁿

 `$result`array

Response data to send to the client.

`$server`[WP_REST_Server](https://developer.wordpress.org/reference/classes/wp_rest_server/)

Server instance.

`$request`[WP_REST_Request](https://developer.wordpress.org/reference/classes/wp_rest_request/)

Request used to generate the response.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/rest_pre_echo_response/?output_format=md#source)󠁿

    ```php
    $result = apply_filters( 'rest_pre_echo_response', $result, $this, $request );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/class-wp-rest-server.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/rest-api/class-wp-rest-server.php#L533)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/class-wp-rest-server.php#L533-L533)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/rest_pre_echo_response/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_REST_Server::serve_request()](https://developer.wordpress.org/reference/classes/wp_rest_server/serve_request/)`wp-includes/rest-api/class-wp-rest-server.php` |

Handles serving a REST API request.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/rest_pre_echo_response/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.8.1](https://developer.wordpress.org/reference/since/4.8.1/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Frest_pre_echo_response%2F)
before being able to contribute a note or feedback.