Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.
$blogusers = get_users('include=5,6,2,7,12,8');
foreach ($blogusers as $user) {

Right now these users will sort by first name. How do I sort this the order the numbers are in "include=..."? i.e. user 5 first, user 6 second, user 2 third etc.

share|improve this question

1 Answer 1

Wordpress returns an array of objects.
Have you tried using 'orderby' as an extra paramiter? eg

$blogusers = get_users('include=5,6,2,7,12,8&orderby=id');
foreach ($blogusers as $user) {
    //This will loop in the order of id 2,5,6,7,12  

Now you know what id's are in what order, you can use some php array sorting functions http://www.php.net/manual/en/function.uasort.php
Also some more at

Its not a total solution but should put you well on your way.

hope it helps!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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