Q: Hide account tab to certain users Hi there i was wondering if it was possible to hide the "Wholesale Ordering Form" to users who are not logged in as Wholesaler, we have made it so other user roles cannot access this section but preferably would want it to not display to regular customers at all. The account tab has been linked using a custom snippet provided by Wholesale Suite for WooCommerce Wholesale Order Form.


A: I'm not sure what the snippet you used is, but you can wrap it in an if statement like this:
if(in_array('wholesaler', wp_get_current_user()->roles)) {
    // Your snippet here
}

This will only run the snippet that adds that tab when the user that is logged in has the wholesaler role. Be sure to replace wholesaler with whatever the slug of that role is on your website.
Edit:
If you want to check multiple arrays, you can just do this:
$roles = wp_get_current_user()->roles;
if(in_array('wholesaler', $roles) || in_array('administrator', $roles)) {
    // Your snippet here
}

If you have more than two roles you want to check, here's an answer on how to check multiple values with in_array.
