[wp-trac] [WordPress Trac] #21581: Add orderby meta_value to WP_User_Query

WordPress Trac wp-trac at lists.automattic.com
Tue Aug 14 21:24:05 UTC 2012


#21581: Add orderby meta_value to WP_User_Query
--------------------------+------------------------------------------------
 Reporter:  wpsmith       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:  has-patch 2nd-opinion dev-feedback
--------------------------+------------------------------------------------
 For some reason, we cannot easily order the WP_User_Query() by last_name
 without directly editing the SQL statements. However, there is an easy way
 to add this that would work parallel to WP_Query().

 {{{
 // prepare arguments
 $args  = array(
         'orderby' => 'meta_value',
         'meta_key' => 'last_name',
 );
 $user_query = new WP_User_Query( $args );
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21581>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list