rest_prepare_autosave
Filters a revision returned from the REST API.
Allows modification of the revision right before it is returned.
Использование
add_filter( 'rest_prepare_autosave', 'wp_kama_rest_prepare_autosave_filter', 10, 3 ); /** * Function for `rest_prepare_autosave` filter-hook. * * @param WP_REST_Response $response The response object. * @param WP_Post $post The original revision object. * @param WP_REST_Request $request Request used to generate the response. * * @return WP_REST_Response */ function wp_kama_rest_prepare_autosave_filter( $response, $post, $request ){ // filter... return $response; }
- $response(WP_REST_Response)
- The response object.
- $post(WP_Post)
- The original revision object.
- $request(WP_REST_Request)
- Request used to generate the response.
Список изменений
С версии 5.0.0 | Введена. |
Где вызывается хук
rest_prepare_autosave
wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php 482
return apply_filters( 'rest_prepare_autosave', $response, $post, $request );