Forums

Sql query to get all users (1 post)

  1. bipies
    Member
    Posted 8 months ago #

    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?

    Thanks!

Reply

You must log in to post.

About this Topic

Tags