Automattic\WooCommerce\Internal\Admin\Orders
Edit::redirect_order
Helper method to redirect to order edit page.
Method of the class: Edit{}
Hooks from the method
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->redirect_order( $order );
- $order(WC_Order) (required)
- Order object.
Changelog
| Since 8.0.0 | Introduced. |
Edit::redirect_order() Edit::redirect order code WC 10.5.0
private function redirect_order( \WC_Order $order ) {
$redirect_to = $this->get_page_controller()->get_edit_url( $order->get_id() );
if ( isset( $this->message ) ) {
$redirect_to = add_query_arg( 'message', $this->message, $redirect_to );
}
wp_safe_redirect(
/**
* Filter the URL used to redirect after an order is updated. Similar to the WP post's `redirect_post_location` filter.
*
* @param string $redirect_to The redirect destination URL.
* @param int $order_id The order ID.
* @param \WC_Order $order The order object.
*
* @since 8.0.0
*/
apply_filters(
'woocommerce_redirect_order_location',
$redirect_to,
$order->get_id(),
$order
)
);
exit;
}