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.
4144* @since 5.6.04145*4146* @param string$new_status The newstatus of the post being restored.4147* @param int$post_id The ID of the post being restored.4148* @param string$previous_status The status of the post at the point where it was trashed.4149*/4150$post_status=apply_filters('wp_untrash_post_status',$new_status,$post_id,$previous_status);41514152delete_post_meta($post_id,'_wp_trash_meta_status');4153delete_post_meta($post_id,'_wp_trash_meta_time');41544155$post_updated=wp_update_post(4156array(
History
Introduced in 5.6.0. Unchanged from 6.7.7 through 7.1.0.