How to change the order in which users are displayed in admin?

Nope, the line you found seems to be some basic preliminary query. Selection of users for display in table seems to be handled by WP_User_Search class. Luckily it can be hooked into easily.

Try this (changes order to descending):

add_action('pre_user_search', 'change_user_order');

function change_user_order($query) {

    $query->query_orderby = ' ORDER BY user_login DESC';
}

PS I am not sure if this can interfere with something else, so might require checks to only run on that specific page.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)