trashed_post
Fires after a post is sent to the Trash.
Usage
add_action( 'trashed_post', 'wp_kama_trashed_post_action', 10, 2 );
/**
* Function for `trashed_post` action-hook.
*
* @param int $post_id Post ID.
* @param string $previous_status The status of the post at the point where it was trashed.
*
* @return void
*/
function wp_kama_trashed_post_action( $post_id, $previous_status ){
// action...
}
- $post_id(int)
- Post ID.
- $previous_status(string)
- The status of the post at the point where it was trashed.
Changelog
| Since 2.9.0 | Introduced. |
| Since 6.3.0 | Added the $previous_status parameter. |
Where the hook is called
trashed_post
wp-includes/post.php 4075
do_action( 'trashed_post', $post_id, $previous_status );
wp-includes/class-wp-customize-manager.php 3129
do_action( 'trashed_post', $post_id, $previous_status );