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.
Built from https://develop.svn.wordpress.org/trunk@47582


git-svn-id: http://core.svn.wordpress.org/trunk@47357 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2020-04-14 19:26:07 +00:00
parent a4f6f2beae
commit 2d04c2e5c8
2 changed files with 17 additions and 9 deletions

View File

@ -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;
}

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.5-alpha-47580';
$wp_version = '5.5-alpha-47582';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.