wp_untrash_post_set_previous_status() WordPress Function

The wp_untrash_post_set_previous_status() function is used to change a post's status back to its original status before it was trashed. This function is useful for restoring a post to its original status after it has been accidentally trashed.

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

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


Description

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


Top ↑

Parameters

$new_status

(string)(Required)The new status of the post being restored.

$post_id

(int)(Required)The ID of the post being restored.

$previous_status

(string)(Required)The status of the post at the point where it was trashed.


Top ↑

Return

(string) The new status of the post.


Top ↑

Source

File: wp-includes/post.php

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

Top ↑

Changelog

Changelog
VersionDescription
5.6.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More