On this page
apply_filters( 'wp_untrash_post_status', string $new_status, int $post_id, string $previous_status )
Filters the status that a post gets assigned when it is restored from the trash (untrashed).
Description
By default posts that are restored will be assigned a status of ‘draft’. Return the value of $previous_status in order to assign the status that the post had before it was trashed. The wp_untrash_post_set_previous_status() function is available for this.
Prior to WordPress 5.6.0, restored posts were always assigned their original status.
Parameters
$new_statusstring-
The new status of the post being restored.
$post_idint-
The ID of the post being restored.
$previous_statusstring-
The status of the post at the point where it was trashed.
Source
File: wp-includes/post.php. View all references
$post_status = apply_filters( 'wp_untrash_post_status', $new_status, $post_id, $previous_status );
Related
Used By
| Used By | Description |
|---|---|
| wp_untrash_post() wp-includes/post.php | Restores a post from the Trash. |
Changelog
| Version | Description |
|---|---|
| 5.6.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/wp_untrash_post_status