Multi Branch for WooCommerce

How to hide certain admin menu items for the ‘Orders manager’ role?

add_action( 'admin_menu', 'wc_remove_menu_items', 999 );
function wc_remove_menu_items() {
	$menu_items = [ 'jetpack', 'edit.php?post_type=viwec_template' ];
	if ( current_user_can( 'orders_manager' ) ) {
		foreach ( $menu_items as $menu_item ) {
			remove_menu_page( $menu_item );
		}
	}
}

Leave a Reply

Your email address will not be published. Required fields are marked *