Automattic\WooCommerce\Internal\Admin\Orders

PageController::set_order_type()privateWC 1.0

Determines the order type for the current screen.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

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

Код PageController::set_order_type() WC 8.7.0

private function set_order_type() {
	global $plugin_page;

	$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();
	}
}