How To Allow other Roles to Access Users Page

Copy and paste this code on your active theme’s “functions.php” file:

  • Allow WPCargo Employee to access “Users” tab:
    function can_wpcumanage_access_roles_callback( $roles ) {
    
    $roles[] = 'wpcargo_employee';
    
    return $roles;
    
    }
    
    add_filter('can_wpcumanage_access_roles', 'can_wpcumanage_access_roles_callback');
    
  • Allow WPCargo Employee to add new users:
    function can_wpcumanage_add_roles_callback( $roles ) {
    
    $roles[] = 'wpcargo_employee';
    
    return $roles;
    
    }
    
    add_filter('can_wpcumanage_add_roles', 'can_wpcumanage_add_roles_callback');
    
  • Allow WPCargo Employee to edit users:
    function can_wpcumanage_update_roles_callback( $roles ) {
    
    $roles[] = 'wpcargo_employee';
    
    return $roles;
    
    }
    
    add_filter('can_wpcumanage_update_roles', 'can_wpcumanage_update_roles_callback');
    
  • Allow WPCargo Employee to delete users:
    function can_wpcumanage_delete_roles_callback( $roles ) {
    
    $roles[] = 'wpcargo_employee';
    
    return $roles;
    
    }
    
    add_filter('can_wpcumanage_delete_roles', 'can_wpcumanage_delete_roles_callback');
    
0
    0
    Your Cart
    Your cart is emptyReturn to Shop