WC_Post_Data::wp_untrash_post_status()public staticWC 1.0

Ensure statuses are correctly reassigned when restoring orders and products.

Method of the class: WC_Post_Data{}

No Hooks.




$result = WC_Post_Data::wp_untrash_post_status( $new_status, $post_id, $previous_status );
$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.

WC_Post_Data::wp_untrash_post_status() code WC 8.6.1

public static function wp_untrash_post_status( $new_status, $post_id, $previous_status ) {
	$post_types = array( 'shop_order', 'shop_coupon', 'product', 'product_variation' );

	if ( in_array( get_post_type( $post_id ), $post_types, true ) ) {
		$new_status = $previous_status;

	return $new_status;