apply_filters( 'rest_request_before_callbacks', WP_REST_Response|WP_HTTP_Response|WP_Error|mixed $response, array $handler, WP_REST_Request $request )
- Since
- 4.7.0
Filters the response before executing any REST API callbacks.
Description
Allows plugins to perform additional validation after a request is initialized and matched to a registered route, but before it is executed.
Note that this filter will not be called for requests that fail to authenticate or match to a registered route.
Parameters
$responseWP_REST_Response|WP_HTTP_Response|WP_Error|mixed- Result to send to the client.
Usually a WP_REST_Response or WP_Error. $handlerarray- Route handler used for the request.
$requestWP_REST_Request- Request used to generate the response.
Fired at · 1
wp-includes/rest-api/class-wp-rest-server.php:1261WP_REST_Server::respond_to_request()
Source
* * @param WP_REST_Response|WP_HTTP_Response|WP_Error|mixed $response Result to send to the client. * Usually a WP_REST_Response or WP_Error. * @param array $handler Route handler used for the request. * @param WP_REST_Request $request Request used to generate the response. */ $response = apply_filters( 'rest_request_before_callbacks', $response, $handler, $request ); // Check permission specified on the route. if ( ! is_wp_error( $response ) && ! empty( $handler['permission_callback'] ) ) { $permission = call_user_func( $handler['permission_callback'], $request ); if ( is_wp_error( $permission ) ) {History
Introduced in 4.7.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.8.8 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.