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'm looking for a way of selecting the users for one site within a multisite set up. Can anyone tell me how to do this please?

This is what I have at the moment:

$user_search = $wpdb->get_results("SELECT ID, display_name, user_email FROM ".$wpdb->base_prefix."users");

but this selects all users across the multisite.

Many thanks!

share|improve this question
up vote 3 down vote accepted

get_users function is the method you should use to query users, and by default it retrieves only users of the current blog in a multisite setup.

share|improve this answer
Thank you for your help – user417627 Oct 24 '12 at 14:36

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.