deleted_post action-hookWP 2.2.0

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     $postid Post ID.
 * @param WP_Post $post   Post object.
 *
 * @return void
 */
function wp_kama_deleted_post_action( $postid, $post ){

	// action...
}
$postid(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

wp_delete_post()
deleted_post
wp_delete_attachment()
deleted_post
wp-includes/post.php 3580
do_action( 'deleted_post', $postid, $post );
wp-includes/post.php 6399
do_action( 'deleted_post', $post_id, $post );

Where the hook is used in WordPress

wp-includes/default-filters.php 751
add_action( 'deleted_post', '_wp_after_delete_font_family', 10, 2 );