Is it possible to Only Show a specific User role in Front-End?

This topic contains 2 replies, has 3 voices, and was last updated by  patrik 2 weeks, 1 day ago.


  • Author
  • #4662

    Hello, is it possible to not just exclude Users by ID? I wonder if it´s possible to completely hide all users with the Role as “Admin”. If there is anyone who could solve this problem I would also pay for this modification of the Plugin.

    Greetings Julian


    Alex Rollin
    Post count: 18504

    Not at this time, but we will keep your suggestion in mind for future versions. We have some role related features coming later in the year, but, right now, since we don’t have other role related features we are saving up ideas for after that release.


    Post count: 1199


    Can you try the following code in functions.php of currently active theme and let me know if it works for you or not?

    add_filter('uwp_excluded_users_from_list', 'uwp_excluded_users_from_list_cb', 10, 1);
    function uwp_excluded_users_from_list_cb($exclude_users){
        $admins = get_users( array( 'role' => 'administrator', 'fields' => array('ID') ) );
        $admins = wp_list_pluck( $admins, 'ID' );
            $exclude_users = array_merge($exclude_users, $admins);
        return $exclude_users;

    You can change the role parameter as per your requirements.


Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.