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?


  • 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();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy