WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
Line | Code |
---|---|
385 | * Allows modification of the response data after inserting |
386 | * embedded data (if any) and before echoing the response data. |
387 | * |
388 | * @since 4.8.1 |
389 | * |
390 | * @param array $result Response data to send to the client. |
391 | * @param WP_REST_Server $this Server instance. |
392 | * @param WP_REST_Request $request Request used to generate the response. |
393 | */ |
394 | $result = apply_filters( 'rest_pre_echo_response', $result, $this, $request ); |
395 |
|
396 | $result = wp_json_encode( $result ); |
397 |
|
398 | $json_error_message = $this->get_json_last_error(); |
399 | if ( $json_error_message ) { |
400 | $json_error_obj = new WP_Error( 'rest_encode_error', $json_error_message, array( 'status' => 500 ) ); |
401 | $result = $this->error_to_response( $json_error_obj ); |
402 | $result = wp_json_encode( $result->data[0] ); |
403 | } |