[wp-hackers] Querying users, orderby last name field?
jpollock412 at gmail.com
Sat Dec 21 01:21:30 UTC 2013
Works like a charm. I ended up needing to add `'fields'=>'all_with_meta'`
to the array so I could use 'last_name' and 'first_name' in the return
Looks like this:
$users = new WP_User_Query(array(
On Fri, Dec 20, 2013 at 3:38 PM, Otto <otto at ottodestruct.com> wrote:
> On Fri, Dec 20, 2013 at 2:25 PM, Josh Pollock <jpollock412 at gmail.com>
> > There doesn't seem to be an orderby option in WP_User_Query to orderby
> > name field. This leaves me wondering why not and what the most direct way
> > to do so would be.
> Does this not work?
> new WP_User_Query(array(
> The last name is not a field that exists in the users table. It's a meta
> field. So you have to specify it and then order by the value of it.
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers