[wp-hackers] get_users() function

Mohammad Jangda batmoo at gmail.com
Fri Dec 11 22:12:59 UTC 2009

Are there any plans to add a get_users-like function to allow
easy retrieval of users based on different criteria? I've seen a few TODOs
in the core code that mention plans to replace some of the SQL queries
related to users with a get_users function but not much more than that.

The closest I've found so far are the wp_user_search class and
get_users_of_blog. The former only does a keyword style search and the
latter doesn't have any options other than blog_id.

For my specific use case (get a list of users based on a usermeta field), I
could very easily write an SQL query, but I'd like to avoid that and stick
to the WordPress API if at all possible. (Though, the wp_user_search class
is pluggable, so I could potentially just override that class).

It looks like this has come up before on wp-hackers (
but there wasn't much discussion around that message. Any thoughts on having
this added to core?

I don't see a trac ticket, but if people think there's value in it, I can
add one.

Mohammad Jangda
www.digitalize.ca | @mjangda <http://twitter.com/mjangda>

More information about the wp-hackers mailing list