WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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 wish to return a WP user list in my plugin where the email address matches @mydomain.com. The user list I am after is for all mydomain.com users.

Does anyone have a code snipit for that?

Thanks.

share|improve this question
    
Take a look at wpusersplugin.com It does a lot with user lists and you could probably dig into the code to find some help. – Doug Jan 11 '12 at 16:17

The search parameter can take an email address and can also accept wildcards:

$wp_user_search = new WP_User_Query( array( 'search' => '*@mydomain.com' ) );
$users = $wp_user_search->get_results();
share|improve this answer

Your Answer

 
discard

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