Remove Woocommerce Menu for Shop Manager Role

Let’s assume that you’d like to hide the WooCommerce menu for a certain user role, shop manager to be exact, and looking for a way to do it.

Using the capability together with the remove_menu() function, we can disable WooCommerce menu for any user roles. The function below is going to hide WooCommerce menu items for everyone except for admin.

add_action( 'admin_menu', 'remove_woocommerce_menu' );
function remove_woocommerce_menu(){
    if ( !current_user_can('manage_options') ) {
        remove_menu_page( 'woocommerce' ); // Menu slug for WooCommerce

Leave a Reply

Your email address will not be published.