//If user = customer, remove the tab on the Vendor Dashboard, but the code is not working. Why?
function is_user_role( $role, $user_id = null ) {
$user = is_numeric( $user_id ) ? get_userdata( $user_id ) : wp_get_current_user();
if( ! $user )
return false;
return in_array( $role, (array) $user->roles );
}
// Пример использования для текущего пользователя
if( is_user_role( ‘customer’ ) ) {
function my_woocommerce_account_menu_items($items) {
unset($items[‘dokan’]); // убрать вкладку Консоль
return $items;
}
add_filter( ‘woocommerce_account_menu_items’, ‘my_woocommerce_account_menu_items’, 100 );