• Resolved animesitesi

    (@animesitesi)


    Hello,

    I want only Authors and Administrators to be listed in the array named /users. I did some editing in the source code, but I couldn’t get any results. How can I make only authors and administrators listed?

    Sorry for the typos, I’m using Translator.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    Can you try the following code in the functions.php file of the currently active theme or via the Code Snippet plugin 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__not_in' => array( 'author', 'administrator' ), 'fields' => array('ID') ) );
    	$admins = wp_list_pluck( $admins, 'ID' );
    	if($admins && count($admins) > 0){
            return $admins;
        }
    	return $exclude_users;
    }

    Regards,
    Patrik

    Thread Starter animesitesi

    (@animesitesi)

    Yes, it works fine. Thank you very much can be a nice feature to add the plugin in the new version.

    Thank you, Have a nice day.

    Sorry for the typos, I’m using Translator.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Filtering in The User List’ is closed to new replies.