deleted_post
Fires immediately after a post is deleted from the database.
Usage
add_action( 'deleted_post', 'wp_kama_deleted_post_action', 10, 2 );
/**
* Function for `deleted_post` action-hook.
*
* @param int $post_id Post ID.
* @param WP_Post $post Post object.
*
* @return void
*/
function wp_kama_deleted_post_action( $post_id, $post ){
// action...
}
- $post_id(int)
- Post ID.
- $post(WP_Post)
- Post object.
Changelog
| Since 2.2.0 | Introduced. |
| Since 5.5.0 | Added the $post parameter. |
Where the hook is called
deleted_post
wp-includes/post.php 3936
do_action( 'deleted_post', $post_id, $post );
wp-includes/post.php 6770
do_action( 'deleted_post', $post_id, $post );
Where the hook is used in WordPress
wp-includes/default-filters.php 782
add_action( 'deleted_post', '_wp_after_delete_font_family', 10, 2 );