Automattic\WooCommerce\Internal\Admin\Orders
PageController::get_base_page_url
Helper method to generate a link to the main screen for a custom order type.
Method of the class: PageController{}
No Hooks.
Returns
String.
Usage
$PageController = new PageController(); $PageController->get_base_page_url( $order_type ): string;
- $order_type(string) (required)
- The order type.
PageController::get_base_page_url() PageController::get base page url code WC 10.6.2
public function get_base_page_url( $order_type ): string {
$order_types_with_ui = wc_get_order_types( 'admin-menu' );
if ( ! in_array( $order_type, $order_types_with_ui, true ) ) {
// translators: %s is a custom order type.
throw new \Exception( sprintf( __( 'Invalid order type: %s.', 'woocommerce' ), esc_html( $order_type ) ) );
}
return admin_url( 'admin.php?page=wc-orders' . ( 'shop_order' === $order_type ? '' : '--' . $order_type ) );
}