rest_delete_attachment
Fires immediately after a single post is deleted or trashed via the REST API.
They dynamic portion of the hook name, $this->post_type, refers to the post type slug.
This is one of the variants of the dynamic hook rest_delete_(post_type)
Usage
add_action( 'rest_delete_attachment', 'wp_kama_rest_delete_attachment_action', 10, 3 ); /** * Function for `rest_delete_attachment` action-hook. * * @param WP_Post $post The deleted or trashed post. * @param WP_REST_Response $response The response data. * @param WP_REST_Request $request The request sent to the API. * * @return void */ function wp_kama_rest_delete_attachment_action( $post, $response, $request ){ // action... }
- $post(WP_Post)
- The deleted or trashed post.
- $response(WP_REST_Response)
- The response data.
- $request(WP_REST_Request)
- The request sent to the API.
Changelog
Since 4.7.0 | Introduced. |
Where the hook is called
rest_delete_attachment
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 1106
do_action( "rest_delete_{$this->post_type}", $post, $response, $request );