Make WordPress Core

Ticket #49597: 49597.diff

File 49597.diff, 832 bytes (added by peterwilsoncc, 5 years ago)
  • src/wp-includes/post.php

    diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
    index 48fe341655..626af6055c 100644
    a b function wp_delete_attachment( $post_id, $force_delete = false ) { 
    56055605                return wp_trash_post( $post_id );
    56065606        }
    56075607
     5608        /**
     5609         * Filters whether an attachment deletion should take place.
     5610         *
     5611         * @since 5.5.0
     5612         *
     5613         * @param bool|null $delete       Whether to go forward with deletion.
     5614         * @param WP_Post   $post         Post object.
     5615         * @param bool      $force_delete Whether to bypass the Trash.
     5616         */
     5617        $check = apply_filters( 'pre_delete_attachment', null, $post, $force_delete );
     5618        if ( null !== $check ) {
     5619                return $check;
     5620        }
     5621
    56085622        delete_post_meta( $post_id, '_wp_trash_meta_status' );
    56095623        delete_post_meta( $post_id, '_wp_trash_meta_time' );
    56105624