0

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.

1
  • 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
    Commented Jan 11, 2012 at 16:17

1 Answer 1

4

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 and acknowledge you have read our privacy policy.