W3cubDocs

/WordPress

do_action( 'delete_post', int $postid, WP_Post $post )

Fires immediately before a post is deleted from the database.

Parameters

$postid

(int) Post ID.

$post

(WP_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 on Trac

Changelog

Version Description
5.5.0 Added the $post parameter.
1.2.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/delete_post