Ticket #58392: 58392.2.diff
File 58392.2.diff, 3.1 KB (added by , 6 months ago) |
---|
-
src/wp-includes/post.php
3573 3573 return false; 3574 3574 } 3575 3575 3576 $previous_status = $post->post_status; 3577 3576 3578 /** 3577 3579 * Filters whether a post trashing should take place. 3578 3580 * 3579 3581 * @since 4.9.0 3582 * @since 6.3.0 Added the `$previous_status` parameter. 3580 3583 * 3581 * @param bool|null $trash Whether to go forward with trashing. 3582 * @param WP_Post $post Post object. 3584 * @param bool|null $trash Whether to go forward with trashing. 3585 * @param WP_Post $post Post object. 3586 * @param string $previous_status The status of the post about to be trashed. 3583 3587 */ 3584 $check = apply_filters( 'pre_trash_post', null, $post );3588 $check = apply_filters( 'pre_trash_post', null, $post, $previous_status ); 3585 3589 3586 3590 if ( null !== $check ) { 3587 3591 return $check; … … 3591 3595 * Fires before a post is sent to the Trash. 3592 3596 * 3593 3597 * @since 3.3.0 3598 * @since 6.3.0 Added the `$previous_status` parameter. 3594 3599 * 3595 * @param int $post_id Post ID. 3600 * @param int $post_id Post ID. 3601 * @param string $previous_status The status of the post about to be trashed. 3596 3602 */ 3597 do_action( 'wp_trash_post', $post_id );3603 do_action( 'wp_trash_post', $post_id, $previous_status ); 3598 3604 3599 add_post_meta( $post_id, '_wp_trash_meta_status', $p ost->post_status );3605 add_post_meta( $post_id, '_wp_trash_meta_status', $previous_status ); 3600 3606 add_post_meta( $post_id, '_wp_trash_meta_time', time() ); 3601 3607 3602 3608 $post_updated = wp_update_post( … … 3616 3622 * Fires after a post is sent to the Trash. 3617 3623 * 3618 3624 * @since 2.9.0 3625 * @since 6.3.0 Added the `$previous_status` parameter. 3619 3626 * 3620 * @param int $post_id Post ID. 3627 * @param int $post_id Post ID. 3628 * @param string $previous_status The status of the post at the point where it was trashed. 3621 3629 */ 3622 do_action( 'trashed_post', $post_id );3630 do_action( 'trashed_post', $post_id, $previous_status ); 3623 3631 3624 3632 return $post; 3625 3633 } … … 3653 3661 * Filters whether a post untrashing should take place. 3654 3662 * 3655 3663 * @since 4.9.0 3656 * @since 5.6.0 The `$previous_status` parameter was added.3664 * @since 5.6.0 Added the `$previous_status` parameter. 3657 3665 * 3658 3666 * @param bool|null $untrash Whether to go forward with untrashing. 3659 3667 * @param WP_Post $post Post object. … … 3668 3676 * Fires before a post is restored from the Trash. 3669 3677 * 3670 3678 * @since 2.9.0 3671 * @since 5.6.0 The `$previous_status` parameter was added.3679 * @since 5.6.0 Added the `$previous_status` parameter. 3672 3680 * 3673 3681 * @param int $post_id Post ID. 3674 3682 * @param string $previous_status The status of the post at the point where it was trashed. … … 3714 3722 * Fires after a post is restored from the Trash. 3715 3723 * 3716 3724 * @since 2.9.0 3717 * @since 5.6.0 The `$previous_status` parameter was added.3725 * @since 5.6.0 Added the `$previous_status` parameter. 3718 3726 * 3719 3727 * @param int $post_id Post ID. 3720 3728 * @param string $previous_status The status of the post at the point where it was trashed.