rest_post_dispatch хук-фильтр . WP 4.4.0
Filters the REST API response.
Allows modification of the response before returning.
Использование
add_filter( 'rest_post_dispatch', 'filter_function_name_4901', 10, 3 ); function filter_function_name_4901( $result, $this, $request ){ // filter... return $result; }
- $result(WP_HTTP_Response)
- Result to send to the client. Usually a WP_REST_Response.
- $this(WP_REST_Server)
- Server instance.
- $request(WP_REST_Request)
- Request used to generate the response.
Список изменений
С версии 4.4.0 | Введена. |
С версии 4.5.0 | Applied to embedded responses. |
Где вызывается хук
rest_post_dispatch
rest_post_dispatch
rest_post_dispatch
wp-includes/rest-api/class-wp-rest-server.php 463
$result = apply_filters( 'rest_post_dispatch', rest_ensure_response( $result ), $this, $request );
wp-includes/rest-api/class-wp-rest-server.php 727
$response = apply_filters( 'rest_post_dispatch', rest_ensure_response( $response ), $this, $request );
wp-includes/rest-api/class-wp-rest-server.php 1595
$result = apply_filters( 'rest_post_dispatch', rest_ensure_response( $result ), $this, $single_request );
Где используется хук в ядре WordPress
wp-includes/rest-api/class-wp-rest-server.php 208
add_filter( 'rest_post_dispatch', 'rest_send_allow_header', 10, 3 );
wp-includes/rest-api/class-wp-rest-server.php 209
add_filter( 'rest_post_dispatch', 'rest_filter_response_fields', 10, 3 );