Title: wp_untrash_post_set_previous_status
Published: December 9, 2020
Last modified: May 20, 2026

---

# wp_untrash_post_set_previous_status( string $new_status, int $post_id, string $previous_status ): string

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_untrash_post_set_previous_status/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/wp_untrash_post_set_previous_status/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_untrash_post_set_previous_status/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_untrash_post_set_previous_status/?output_format=md#source)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_untrash_post_set_previous_status/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_untrash_post_set_previous_status/?output_format=md#wp--skip-link--target)

Filters callback which sets the status of an untrashed post to its previous status.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_untrash_post_set_previous_status/?output_format=md#description)󠁿

This can be used as a callback on the `wp_untrash_post_status` filter.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/wp_untrash_post_set_previous_status/?output_format=md#parameters)󠁿

 `$new_status`stringrequired

The new status of the post being restored.

`$post_id`intrequired

The ID of the post being restored.

`$previous_status`stringrequired

The status of the post at the point where it was trashed.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_untrash_post_set_previous_status/?output_format=md#return)󠁿

 string The new status of the post.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_untrash_post_set_previous_status/?output_format=md#source)󠁿

    ```php
    function wp_untrash_post_set_previous_status( $new_status, $post_id, $previous_status ) {
    	return $previous_status;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/post.php#L8539)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/post.php#L8539-L8541)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_untrash_post_set_previous_status/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_untrash_post_set_previous_status%2F)
before being able to contribute a note or feedback.