WordPress.org

Make WordPress Core

Changeset 34082


Ignore:
Timestamp:
09/12/2015 03:58:09 PM (6 years ago)
Author:
wonderboymusic
Message:

wp_delete_post(): add a filter, 'pre_delete_post', to allow bailout from the function if the filter returns a non-null value.

Props boonebgorges.
Fixes #32933.

File:
1 edited

Legend:

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

    r34081 r34082  
    23192319
    23202320    /**
     2321     * Filter whether a post deletion should take place.
     2322     *
     2323     * @since 4.4.0
     2324     *
     2325     * @param bool    $delete       Whether to go forward with deletion.
     2326     * @param WP_Post $post         Post object.
     2327     * @param bool    $force_delete Whether to bypass the trash.
     2328     */
     2329    $check = apply_filters( 'pre_delete_post', null, $post, $force_delete );
     2330    if ( null !== $check ) {
     2331        return $check;
     2332    }
     2333
     2334    /**
    23212335     * Fires before a post is deleted, at the start of wp_delete_post().
    23222336     *
Note: See TracChangeset for help on using the changeset viewer.