WordPress.org

Make WordPress Core

Changeset 47856


Ignore:
Timestamp:
05/26/2020 02:47:26 PM (17 months ago)
Author:
ocean90
Message:

Posts, Post Types: Pass the post object to the delete_attachment action.

Also add the missing $post parameter to the delete_post and deleted_post actions in wp_delete_attachment().

See #30940.

File:
1 edited

Legend:

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

    r47851 r47856  
    57185718     *
    57195719     * @since 2.0.0
    5720      *
    5721      * @param int $post_id Attachment ID.
     5720     * @since 5.5.0 Added the `$post` parameter.
     5721     *
     5722     * @param int     $post_id Attachment ID.
     5723     * @param WP_Post $post    Post object.
    57225724     */
    5723     do_action( 'delete_attachment', $post_id );
     5725    do_action( 'delete_attachment', $post_id, $post );
    57245726
    57255727    wp_delete_object_term_relationships( $post_id, array( 'category', 'post_tag' ) );
     
    57445746
    57455747    /** This action is documented in wp-includes/post.php */
    5746     do_action( 'delete_post', $post_id );
     5748    do_action( 'delete_post', $post_id, $post );
    57475749    $result = $wpdb->delete( $wpdb->posts, array( 'ID' => $post_id ) );
    57485750    if ( ! $result ) {
     
    57505752    }
    57515753    /** This action is documented in wp-includes/post.php */
    5752     do_action( 'deleted_post', $post_id );
     5754    do_action( 'deleted_post', $post_id, $post );
    57535755
    57545756    wp_delete_attachment_files( $post_id, $meta, $backup_sizes, $file );
Note: See TracChangeset for help on using the changeset viewer.