Posts, Post Types: Pass the post object to the before_delete_post
, delete_post
, deleted_post
, and after_delete_post
actions.
Props jadpm. Fixes #30940. git-svn-id: https://develop.svn.wordpress.org/trunk@47582 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
7ef97cfb10
commit
165bcc506d
@ -2996,12 +2996,14 @@ function wp_delete_post( $postid = 0, $force_delete = false ) {
|
||||
* Fires before a post is deleted, at the start of wp_delete_post().
|
||||
*
|
||||
* @since 3.2.0
|
||||
* @since 5.5.0 Added the `$post` parameter.
|
||||
*
|
||||
* @see wp_delete_post()
|
||||
*
|
||||
* @param int $postid Post ID.
|
||||
* @param int $postid Post ID.
|
||||
* @param WP_Post $post Post object.
|
||||
*/
|
||||
do_action( 'before_delete_post', $postid );
|
||||
do_action( 'before_delete_post', $postid, $post );
|
||||
|
||||
delete_post_meta( $postid, '_wp_trash_meta_status' );
|
||||
delete_post_meta( $postid, '_wp_trash_meta_time' );
|
||||
@ -3048,10 +3050,12 @@ function wp_delete_post( $postid = 0, $force_delete = false ) {
|
||||
* Fires immediately before a post is deleted from the database.
|
||||
*
|
||||
* @since 1.2.0
|
||||
* @since 5.5.0 Added the `$post` parameter.
|
||||
*
|
||||
* @param int $postid Post ID.
|
||||
* @param int $postid Post ID.
|
||||
* @param WP_Post $post Post object.
|
||||
*/
|
||||
do_action( 'delete_post', $postid );
|
||||
do_action( 'delete_post', $postid, $post );
|
||||
$result = $wpdb->delete( $wpdb->posts, array( 'ID' => $postid ) );
|
||||
if ( ! $result ) {
|
||||
return false;
|
||||
@ -3061,10 +3065,12 @@ function wp_delete_post( $postid = 0, $force_delete = false ) {
|
||||
* Fires immediately after a post is deleted from the database.
|
||||
*
|
||||
* @since 2.2.0
|
||||
* @since 5.5.0 Added the `$post` parameter.
|
||||
*
|
||||
* @param int $postid Post ID.
|
||||
* @param int $postid Post ID.
|
||||
* @param WP_Post $post Post object.
|
||||
*/
|
||||
do_action( 'deleted_post', $postid );
|
||||
do_action( 'deleted_post', $postid, $post );
|
||||
|
||||
clean_post_cache( $post );
|
||||
|
||||
@ -3080,12 +3086,14 @@ function wp_delete_post( $postid = 0, $force_delete = false ) {
|
||||
* Fires after a post is deleted, at the conclusion of wp_delete_post().
|
||||
*
|
||||
* @since 3.2.0
|
||||
* @since 5.5.0 Added the `$post` parameter.
|
||||
*
|
||||
* @see wp_delete_post()
|
||||
*
|
||||
* @param int $postid Post ID.
|
||||
* @param int $postid Post ID.
|
||||
* @param WP_Post $post Post object.
|
||||
*/
|
||||
do_action( 'after_delete_post', $postid );
|
||||
do_action( 'after_delete_post', $postid, $post );
|
||||
|
||||
return $post;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user