delete_post_(post_type)
Fires immediately before a post is deleted from the database.
The dynamic portion of the hook name, $post->post_type, refers to the post type slug.
Usage
add_action( 'delete_post_(post_type)', 'wp_kama_delete_post_type_action', 10, 2 ); /** * Function for `delete_post_(post_type)` action-hook. * * @param int $post_id Post ID. * @param WP_Post $post Post object. * * @return void */ function wp_kama_delete_post_type_action( $post_id, $post ){ // action... }
- $post_id(int)
- Post ID.
- $post(WP_Post)
- Post object.
Changelog
Since 6.6.0 | Introduced. |
Where the hook is called
delete_post_(post_type)
wp-includes/post.php 3603
do_action( "delete_post_{$post->post_type}", $post_id, $post );