On this page
do_action( 'delete_post', int $postid, WP_Post $post )
Fires immediately before a post is deleted from the database.
Parameters
$postidint-
Post ID.
$postWP_Post-
Post object.
More Information
Take note, by the time the hook triggers, the post comments and metadata would have already been deleted. Use the before_delete_post hook to catch post deletion before that.
Source
File: wp-includes/post.php. View all references
do_action( 'delete_post', $postid, $post );
Related
Used By
| Used By | Description |
|---|---|
| wp_delete_attachment() wp-includes/post.php | Trashes or deletes an attachment. |
| wp_delete_post() wp-includes/post.php | Trashes or deletes a post or page. |
Changelog
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/delete_post