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.

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

1 Answer 1

up vote 4 down vote accepted

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.

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