Display Authors Selectively

If I were you, I would avoid custom SQL if there are perfectly fine WordPress functions for your needs.

Otherwise there’s a risk that you might leave vulnerabilities or backdoors to your database which might lead to complete loss/corruption of data in the future.


Like any other query: the more arguments you use, the heavier it gets. Just make sure it does what you want and avoid unnecessary arguments. Learn more here -> WP_User_Query()

<?php

//Some selection of parameters (look codex for me)
$args = array(

    'role'           => 'Subscriber',
    'include'        => array( 1, 2, 3 ), //user IDs
    'exclude'        => array( 4, 5, 6 ), //user IDs
    'search'         => 'Rami', //Keyword search
    'user_login'     => 'demo-user',
    'user_nicename'  => 'Demo User',
    'user_email'     => '[email protected]',
    'user_url'       => 'www.demouserwebsite.com',
    'number'         => 5, //Count of users to get
    'orderby'        => 'post_count' //How to order them
);

$authors = new WP_User_Query( $args );

?>

If you want to change the order of single authors, Im afraid you’ll need to add new user meta (int) to all authors. This would serve as order number which you can use as orderby argument.