Automattic\WooCommerce\Internal\Admin

Homescreen::possibly_remove_woocommerce_menu()publicWC 1.0

Possibly remove the WooCommerce menu item if it was purely used to access wc-admin pages.

Method of the class: Homescreen{}

No Hooks.

Return

null. Nothing (null).

Usage

$Homescreen = new Homescreen();
$Homescreen->possibly_remove_woocommerce_menu();

Homescreen::possibly_remove_woocommerce_menu() code WC 9.3.3

public function possibly_remove_woocommerce_menu() {
	global $menu;

	if ( self::is_admin_user() ) {
		return;
	}

	foreach ( $menu as $key => $menu_item ) {
		if ( self::MENU_SLUG !== $menu_item[2] || 'read' !== $menu_item[1] ) {
			continue;
		}

		unset( $menu[ $key ] );
	}
}