Automattic\WooCommerce\Internal\Admin\Orders
PostsRedirectionController::maybe_redirect_to_new_order_page()
If needed, performs a redirection to the new order page.
Method of the class: PostsRedirectionController{}
No Hooks.
Return
null
. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->maybe_redirect_to_new_order_page(): void;
PostsRedirectionController::maybe_redirect_to_new_order_page() PostsRedirectionController::maybe redirect to new order page code WC 8.7.0
private function maybe_redirect_to_new_order_page(): void { $post_type = $_GET['post_type'] ?? ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized if ( ! $post_type || ! in_array( $post_type, wc_get_order_types( 'admin-menu' ), true ) ) { 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( $post_type ); $new_url = add_query_arg( $query_args, $new_url ); wp_safe_redirect( $new_url, 301 ); exit; }