Support » Fixing WordPress » Sql query to get all users

  • Hi:

    I’m using this sql query to get all users:

    $excluded = '1,29,24';
    $sql = 'SELECT distinct post_author FROM '.$wpdb->posts. " WHERE post_author NOT IN ($excluded) ORDER BY rand()";
    $authors = $wpdb->get_results($sql)


    But whe executed always appear a repeated user with wrong “latest post” and don’t know why, any idea?


  • The topic ‘Sql query to get all users’ is closed to new replies.