Posts, Post Types: Introduce `delete_post_{$post->post_type}` and `deleted_post_{$post->post_type}` hooks.
The hooks fire before the general `delete_post` / `deleted_post` hooks and have the same parameters. They complement the `save_post_{$post->post_type}` hook added in [25050] and the `edit_post_{$post->post_type}` hook added in [43617]. Props benniledl, swissspidy, dargus. Fixes #60433. Built from https://develop.svn.wordpress.org/trunk@57853 git-svn-id: http://core.svn.wordpress.org/trunk@57354 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9ed35adffa
commit
5cb687dbce
|
@ -3552,6 +3552,19 @@ function wp_delete_post( $postid = 0, $force_delete = false ) {
|
|||
delete_metadata_by_mid( 'post', $mid );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires immediately before a post is deleted from the database.
|
||||
*
|
||||
* The dynamic portion of the hook name, `$post->post_type`, refers to
|
||||
* the post type slug.
|
||||
*
|
||||
* @since 6.6.0
|
||||
*
|
||||
* @param int $postid Post ID.
|
||||
* @param WP_Post $post Post object.
|
||||
*/
|
||||
do_action( "delete_post_{$post->post_type}", $postid, $post );
|
||||
|
||||
/**
|
||||
* Fires immediately before a post is deleted from the database.
|
||||
*
|
||||
|
@ -3568,6 +3581,19 @@ function wp_delete_post( $postid = 0, $force_delete = false ) {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires immediately after a post is deleted from the database.
|
||||
*
|
||||
* The dynamic portion of the hook name, `$post->post_type`, refers to
|
||||
* the post type slug.
|
||||
*
|
||||
* @since 6.6.0
|
||||
*
|
||||
* @param int $postid Post ID.
|
||||
* @param WP_Post $post Post object.
|
||||
*/
|
||||
do_action( "deleted_post_{$post->post_type}", $postid, $post );
|
||||
|
||||
/**
|
||||
* Fires immediately after a post is deleted from the database.
|
||||
*
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.6-alpha-57851';
|
||||
$wp_version = '6.6-alpha-57853';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue