Automattic\WooCommerce\Internal\Admin\Orders

PostsRedirectionController::maybe_redirect_to_new_order_page()privateWC 1.0

If needed, performs a redirection to the new order page.

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

Хуков нет.

Возвращает

null. Ничего.

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

// private - только в коде основоного (родительского) класса
$result = $this->maybe_redirect_to_new_order_page(): void;

Код PostsRedirectionController::maybe_redirect_to_new_order_page() WC 7.1.0

private function maybe_redirect_to_new_order_page(): void {
	if ( ! isset( $_GET['post_type'] ) || 'shop_order' !== $_GET['post_type'] ) {
		return;
	}

	// Respect query args, except for 'post_type'.
	$query_args = wp_unslash( $_GET );
	unset( $query_args['post_type'] );

	$new_url = $this->page_controller->get_new_page_url();
	$new_url = add_query_arg( $query_args, $new_url );

	wp_safe_redirect( $new_url, 301 );
	exit;
}