Alright, so here's my current code (which works, displaying the users in order by ID and excluding the admin user):

$site_admin = "1";
$order = 'ID';
$user_ids = $wpdb->get_col("SELECT ID FROM $wpdb->usermeta WHERE ID != '$site_admin' ORDER BY $order"); // query users
foreach($user_ids as $user_id) : // start authors' profile "loop"
    $user = get_userdata($user_id);

    $level = $user->user_level;
    if ($level > 0) 
    { ?>

    ((information to display goes here))

   <?php  } ?>

What I'd like to do is add a meta field (I believe that's the right terminology, but please correct if wrong), and I have already added that, then type in a number for each author.

Here's how that was added (in functions.php):

<?php function my_new_contactmethods( $contactmethods ) {
$contactmethods['order'] = 'Order on the About Page'; 
return $contactmethods;

Last, I'd like to display the users in that order.

There are a number of related questions, but none that I could find that order the users by fields which are added in addition to the typical Wordpress user information (e.g. ID, user_nicename, etc.) I can simply replace "ID" in the code above with "user_nicename" and that works fine, but I need to be able to manually set the order of each of the users, so none of the built-in fields will work for that purpose.

  • Is this question about adding a field to the user profile, or listing users by that field? Note that we have a 1 question per question policy
    – Tom J Nowell
    Aug 29, 2014 at 12:15

1 Answer 1


You can use the default function get_users(), and then re order the result by the meta id. Here is the answer

  • Well, I'm already ordering them by ID; I'm hoping to order them by something else – however, I might be able to adapt something here, so thanks! Aug 17, 2012 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.