Skip to main content
better formatting
Source Link
Pieter Goosen
  • 55.4k
  • 23
  • 115
  • 209
<?php
$blogusers = get_users('include=5,6,2,7,12,8');
foreach ($blogusers as $user) {
...         
}
?>

Right now, these users will sortsorted by first name. 

How do I sort this in the order the numbers are in "include=..."include=...? i.e. user

Example:

User 5 first, user 6 second, user 2 third etc.

<?php
$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.

<?php
$blogusers = get_users('include=5,6,2,7,12,8');
foreach ($blogusers as $user) {
...         
}
?>

Right now, these users will sorted by first name. 

How do I sort this in the order the numbers are in include=...?

Example:

User 5 first, user 6 second, user 2 third etc.

Tweeted twitter.com/#!/StackWordPress/status/254642543478845440
Source Link
nicolas
  • 265
  • 2
  • 3
  • 8

Sort users in get_users() in custom order

<?php
$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.