| 874 | /** |
| 875 | * Call a filter before executing any REST API callbacks. |
| 876 | * |
| 877 | * Allows plugins to perform additional validation after a |
| 878 | * request is initialized and matched to a registered route, |
| 879 | * but before it is executed. |
| 880 | * |
| 881 | * Note that this filter will not be called for requests that |
| 882 | * fail to authenticate or match to a registered route. |
| 883 | * |
| 884 | * @since ?? |
| 885 | * |
| 886 | * @param WP_HTTP_Response $response Result to send to the client. Usually a WP_REST_Response. |
| 887 | * @param WP_REST_Server $handler ResponseHandler instance (usually WP_REST_Server). |
| 888 | * @param WP_REST_Request $request Request used to generate the response. |
| 889 | */ |
| 890 | $response = apply_filters( 'rest_request_before_callbacks', $response, $handler, $request ); |
| 891 | |
| 929 | /** |
| 930 | * Call a filter immediately after executing any REST API |
| 931 | * callbacks. |
| 932 | * |
| 933 | * Allows plugins to perform any needed cleanup, for example, |
| 934 | * to undo changes made during `rest_request_before_callbacks`. |
| 935 | * |
| 936 | * Note that this filter will not be called for requests that |
| 937 | * fail to authenticate or match to a registered route. |
| 938 | * |
| 939 | * Note that an endpoint's `permission_callback` can still be |
| 940 | * called after this filter - see the `rest_send_allow_header` |
| 941 | * function. |
| 942 | * |
| 943 | * @since ?? |
| 944 | * |
| 945 | * @param WP_HTTP_Response $response Result to send to the client. Usually a WP_REST_Response. |
| 946 | * @param WP_REST_Server $handler ResponseHandler instance (usually WP_REST_Server). |
| 947 | * @param WP_REST_Request $request Request used to generate the response. |
| 948 | */ |
| 949 | $response = apply_filters( 'rest_request_after_callbacks', $response, $handler, $request ); |
| 950 | |