do_action( 'before_delete_post', int $postid, WP_Post $post )
Fires before a post is deleted, at the start of wp_delete_post().
Description
See also
Parameters
- $postid
-
(int) Post ID.
- $post
-
(WP_Post) Post object.
More Information
It’s important to note the hook runs only when the WordPress user empties the Trash. If you’re using this hook note that it will not fire if the user is deleting an Attachment, since attachments are force deleted, i.e., not sent to the Trash. Instead use the delete_post() hook.
Source
File: wp-includes/post.php
Changelog
Version | Description |
---|---|
5.5.0 | Added the $post parameter. |
3.2.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/before_delete_post