Remove the home submenu page for the shop manager user role in WooCommerce

Remove the home submenu page for the shop manager user role in WooCommerce on child sites.

Snippet Type

Execute on Child Sites

Snippet

add_action( 'admin_menu', 'disable_admin_woocommerce_home_for_user_role', 999 );
function disable_admin_woocommerce_home_for_user_role() {
    $targeted_role = 'shop_manager'; // Here define the user role

    if (current_user_can( $targeted_role ) && ! isset($_GET['path'])) {
        remove_submenu_page( 'woocommerce', 'wc-admin' );
    }
}

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.