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. Built from https://develop.svn.wordpress.org/trunk@47856 git-svn-id: http://core.svn.wordpress.org/trunk@47632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7b192d406a
commit
a01835679a
|
@ -5717,10 +5717,12 @@ function wp_delete_attachment( $post_id, $force_delete = false ) {
|
||||||
* Fires before an attachment is deleted, at the start of wp_delete_attachment().
|
* Fires before an attachment is deleted, at the start of wp_delete_attachment().
|
||||||
*
|
*
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
|
* @since 5.5.0 Added the `$post` parameter.
|
||||||
*
|
*
|
||||||
* @param int $post_id Attachment ID.
|
* @param int $post_id Attachment ID.
|
||||||
|
* @param WP_Post $post Post object.
|
||||||
*/
|
*/
|
||||||
do_action( 'delete_attachment', $post_id );
|
do_action( 'delete_attachment', $post_id, $post );
|
||||||
|
|
||||||
wp_delete_object_term_relationships( $post_id, array( 'category', 'post_tag' ) );
|
wp_delete_object_term_relationships( $post_id, array( 'category', 'post_tag' ) );
|
||||||
wp_delete_object_term_relationships( $post_id, get_object_taxonomies( $post->post_type ) );
|
wp_delete_object_term_relationships( $post_id, get_object_taxonomies( $post->post_type ) );
|
||||||
|
@ -5743,13 +5745,13 @@ function wp_delete_attachment( $post_id, $force_delete = false ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This action is documented in wp-includes/post.php */
|
/** This action is documented in wp-includes/post.php */
|
||||||
do_action( 'delete_post', $post_id );
|
do_action( 'delete_post', $post_id, $post );
|
||||||
$result = $wpdb->delete( $wpdb->posts, array( 'ID' => $post_id ) );
|
$result = $wpdb->delete( $wpdb->posts, array( 'ID' => $post_id ) );
|
||||||
if ( ! $result ) {
|
if ( ! $result ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/** This action is documented in wp-includes/post.php */
|
/** This action is documented in wp-includes/post.php */
|
||||||
do_action( 'deleted_post', $post_id );
|
do_action( 'deleted_post', $post_id, $post );
|
||||||
|
|
||||||
wp_delete_attachment_files( $post_id, $meta, $backup_sizes, $file );
|
wp_delete_attachment_files( $post_id, $meta, $backup_sizes, $file );
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.5-alpha-47855';
|
$wp_version = '5.5-alpha-47856';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue