Automattic\WooCommerce\Internal\Admin\Orders
PageController::set_order_type()
Determines the order type for the current screen.
Method of the class: PageController{}
No Hooks.
Return
null
. Nothing.
Usage
// private - for code of main (parent) class only $result = $this->set_order_type();
PageController::set_order_type() PageController::set order type code WC 7.7.0
private function set_order_type() { global $plugin_page, $pagenow; if ( 'admin.php' !== $pagenow || 0 !== strpos( $plugin_page, 'wc-orders' ) ) { return; } $this->order_type = str_replace( array( 'wc-orders--', 'wc-orders' ), '', $plugin_page ); $this->order_type = empty( $this->order_type ) ? 'shop_order' : $this->order_type; $wc_order_type = wc_get_order_type( $this->order_type ); $wp_order_type = get_post_type_object( $this->order_type ); if ( ! $wc_order_type || ! $wp_order_type || ! $wp_order_type->show_ui || ! current_user_can( $wp_order_type->cap->edit_posts ) ) { wp_die(); } }