Opened 9 months ago

Last modified 9 months ago

#21581 new defect (bug)

Add orderby meta_value to WP_User_Query

Reported by: wpsmith Owned by:
Priority: normal Milestone: Awaiting Review
Component: General Version:
Severity: normal Keywords: has-patch 2nd-opinion dev-feedback
Cc:

Description

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 );

Attachments (1)

21581_user.patch (448 bytes) - added by wpsmith 9 months ago.

Download all attachments as: .zip

Change History (2)

Note: See TracTickets for help on using tickets.