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. git-svn-id: https://develop.svn.wordpress.org/trunk@34082 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8ef82f4792
commit
9eb5abbccb
@ -2317,6 +2317,20 @@ function wp_delete_post( $postid = 0, $force_delete = false ) {
|
||||
if ( $post->post_type == 'attachment' )
|
||||
return wp_delete_attachment( $postid, $force_delete );
|
||||
|
||||
/**
|
||||
* Filter whether a post deletion should take place.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @param bool $delete Whether to go forward with deletion.
|
||||
* @param WP_Post $post Post object.
|
||||
* @param bool $force_delete Whether to bypass the trash.
|
||||
*/
|
||||
$check = apply_filters( 'pre_delete_post', null, $post, $force_delete );
|
||||
if ( null !== $check ) {
|
||||
return $check;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires before a post is deleted, at the start of wp_delete_post().
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user