do_action( 'before_delete_post', int $postid , WP_Post $post )
Fires before a post is deleted, at the start of wp_delete_post().
Contents
Description Description
See also See also
Parameters Parameters
- $postid
-
(int) Post ID.
- $post
-
(WP_Post) Post object.
More Information 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 Source
File: wp-includes/post.php
Changelog Changelog
Version | Description |
---|---|
5.5.0 | Added the $post parameter. |
3.2.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Let’s suppose you have a plugin and when a certain post_type is deleted you want to perform some action.
Expand full source codeCollapse full source code