wphooks.info - rest_request_before_callbacks

rest_request_before_callbacks

(trunk - 5.1-alpha-44286)

The hook occurs in the following file:

wp-includes/rest-api/class-wp-rest-server.php:
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
				 *
				 * Note that this filter will not be called for requests that
				 * fail to authenticate or match to a registered route.
				 *
				 * @since 4.7.0
				 *
				 * @param WP_HTTP_Response|WP_Error $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 );

				if ( ! is_wp_error( $response ) ) {
					// Check permission specified on the route.
					if ( ! empty( $handler['permission_callback'] ) ) {
						$permission = call_user_func( $handler['permission_callback'], $request );

						if ( is_wp_error( $permission ) ) {
							$response = $permission;
						} elseif ( false === $permission || null === $permission ) {