I'm using a custom SQL query to fetch a list of authors.
While I have it working and excluding certain ID's (admins etc), the list is coming in ordered by ID.
Can someone please help me reorder this list by the users' name? It's nearly 3am, I'm a SQL noob and I've tried doing this myself with no joy.
My code so far:
<?php $excluded = "1,77"; // To exclude admin ID's $sql = 'SELECT DISTINCT post_author FROM '.$wpdb->posts. " WHERE post_author NOT IN ($excluded) ORDER BY ID ASC"; $authors = $wpdb->get_results($sql); if($authors): foreach($authors as $author): ?>