WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have many users on my website, out of some has status "elite". I am saving this status in meta key/value for each user ('meta_key' => 'elite_member', 'meta_value' => '1').

I want to display randomly 2 user profiles in rotation on my site home page which has status "elite" so that each user profiles will appear same no. of times in rotation. I am able to get all the users with meta_key "elite" and meta_value="1"

$elite_members=get_users(array('meta_key' => 'elite_member', 'meta_value' => '1'));

But I am not able to get how to display 2 user profiles in rotation so that each user will get same no. of chance to appear on home page.

share|improve this question

As get_users does not support the order_by random, you could shuffle the array after calling the function.

If you want to distribute it even, you could make another meta_value, where you store the number of appearances per user, and call the get_users with this new meta_key in ascending sort_order - this way the user with the least appearances will be shown on the homepage.

share|improve this answer
could u pls write example of how to call get_users with new meta_key in ascending sort_order? I am not able to do that after looking the get_users parameters.Thanks – Pritesh Gupta Nov 28 '12 at 8:07

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.