Make WordPress Core

Changeset 47582


Ignore:
Timestamp:
04/14/2020 07:24:49 PM (5 years ago)
Author:
ocean90
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post.php

    r47557 r47582  
    29972997     *
    29982998     * @since 3.2.0
     2999     * @since 5.5.0 Added the `$post` parameter.
    29993000     *
    30003001     * @see wp_delete_post()
    30013002     *
    3002      * @param int $postid Post ID.
     3003     * @param int     $postid Post ID.
     3004     * @param WP_Post $post   Post object.
    30033005     */
    3004     do_action( 'before_delete_post', $postid );
     3006    do_action( 'before_delete_post', $postid, $post );
    30053007
    30063008    delete_post_meta( $postid, '_wp_trash_meta_status' );
     
    30493051     *
    30503052     * @since 1.2.0
    3051      *
    3052      * @param int $postid Post ID.
     3053     * @since 5.5.0 Added the `$post` parameter.
     3054     *
     3055     * @param int     $postid Post ID.
     3056     * @param WP_Post $post   Post object.
    30533057     */
    3054     do_action( 'delete_post', $postid );
     3058    do_action( 'delete_post', $postid, $post );
    30553059    $result = $wpdb->delete( $wpdb->posts, array( 'ID' => $postid ) );
    30563060    if ( ! $result ) {
     
    30623066     *
    30633067     * @since 2.2.0
    3064      *
    3065      * @param int $postid Post ID.
     3068     * @since 5.5.0 Added the `$post` parameter.
     3069     *
     3070     * @param int     $postid Post ID.
     3071     * @param WP_Post $post   Post object.
    30663072     */
    3067     do_action( 'deleted_post', $postid );
     3073    do_action( 'deleted_post', $postid, $post );
    30683074
    30693075    clean_post_cache( $post );
     
    30813087     *
    30823088     * @since 3.2.0
     3089     * @since 5.5.0 Added the `$post` parameter.
    30833090     *
    30843091     * @see wp_delete_post()
    30853092     *
    3086      * @param int $postid Post ID.
     3093     * @param int     $postid Post ID.
     3094     * @param WP_Post $post   Post object.
    30873095     */
    3088     do_action( 'after_delete_post', $postid );
     3096    do_action( 'after_delete_post', $postid, $post );
    30893097
    30903098    return $post;
Note: See TracChangeset for help on using the changeset viewer.