WC_Post_Data::wp_untrash_post_status()public staticWC 1.0

Ensure statuses are correctly reassigned when restoring orders and products.

Метод класса: WC_Post_Data{}

Хуков нет.

Возвращает

Строку.

Использование

$result = WC_Post_Data::wp_untrash_post_status( $new_status, $post_id, $previous_status );
$new_status(строка) (обязательный)
The new status of the post being restored.
$post_id(int) (обязательный)
The ID of the post being restored.
$previous_status(строка) (обязательный)
The status of the post at the point where it was trashed.

Код WC_Post_Data::wp_untrash_post_status() WC 9.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;
}