Exclude admin from user list


Hi i’m fairly new to PHP and WordPress, i’m using a plugin (Users Insight) to list all users on my site.

The problem is, that i don’t want to admin to appear in that list.

So far i’ve found the function that calls to list, but i’m not sure how to edit it so that it exclude the admin role.

    public function get_users($default_fields = null){
    global $wpdb;

    $results =  $wpdb->get_results( $this->query );

    $total = $wpdb->get_var( 'SELECT FOUND_ROWS()' );
    $users = $this->db_rows_to_objects($results);

    $all_users = count_users();
    return array('users'=>$users, 'total'=> $total, 'alltotal'=>$all_users['total_users']);



>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="https://www.wptricks.com/question/exclude-admin-from-user-list/">

Exclude admin from user list</a>
, PKG 4 years 0 Answers 47 views 0

Leave an answer