Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Talk:Function Reference/get users

I suggest to modify the role parameter to accept more values (arrays).

role - An array of roles. Only users matching these roles will be returned.

array('editor','author','contributor')

Look at 'UPDATE 7/11/10' http://sltaylor.co.uk/blog/get-wordpress-users-by-role/

Missing 'meta_query' documentation

I found absolutely no documentation either on the codex, or in the core code itself for this.

As it turns out thoughh, WP_User_Query, and so too get_users() can handle the 'meta_query' value that allows for more complex meta queries.

http://core.trac.wordpress.org/browser/tags/3.4/wp-includes/user.php#L517

This is well documented in the WP_Query codex page - http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters


It looks like this is now fixed, and there are links to the documentation of this feature at WP_Query, as you pointed out.
Jdgrimes 15:42, 15 October 2013 (UTC)

argument 'count_total' hardcoded to false

the optional argument 'count_total' does not default to false, it is hardcoded to be always false. Suggestion: remove this argument (at least from the documentation) , or don't hardcode it to false and make the return value somehow accessible.


I've updated the documentation to reflect the fact that this feature is disabled, and that to use it WP_User_Query must be used directly. If you want to see this feature changed, the place to request that is on Trac.
Jdgrimes 15:36, 15 October 2013 (UTC)