Automattic\WooCommerce\Internal\Admin

Homescreen::is_admin_user()public staticWC 1.0

Check if the user can access the top-level WooCommerce item.

{} Это метод класса: Homescreen{}

Хуков нет.

Возвращает

true|false.

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

$result = Homescreen::is_admin_user();

Код Homescreen::is_admin_user() WC 6.9.4

public static function is_admin_user() {
	if ( ! class_exists( 'WC_Admin_Menus', false ) ) {
		include_once WC_ABSPATH . 'includes/admin/class-wc-admin-menus.php';
	}
	if ( method_exists( 'WC_Admin_Menus', 'can_view_woocommerce_menu_item' ) ) {
		return \WC_Admin_Menus::can_view_woocommerce_menu_item() || current_user_can( 'manage_woocommerce' );
	} else {
		// We leave this line for WC versions <= 6.2.
		return current_user_can( 'edit_others_shop_orders' ) || current_user_can( 'manage_woocommerce' );
	}
}