Make WordPress Core

Opened 13 years ago

Closed 12 years ago

Last modified 11 years ago

#21581 closed enhancement (fixed)

Add orderby meta_value to WP_User_Query

Reported by: wpsmith's profile wpsmith Owned by: wonderboymusic's profile wonderboymusic
Milestone: 3.7 Priority: normal
Severity: normal Version:
Component: Users Keywords: has-patch
Focuses: 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 13 years ago.

Download all attachments as: .zip

Change History (11)

@wpsmith
13 years ago

#2 @iseulde
12 years ago

  • Component changed from General to Query

#3 @wonderboymusic
12 years ago

  • Keywords 2nd-opinion dev-feedback removed
  • Milestone changed from Awaiting Review to 3.7

Makes sense, patch still applies

#4 @hotchkissconsulting
12 years ago

Tested with latest trunk, patch works

#6 @c3mdigital
12 years ago

#17179 was marked as a duplicate.

#7 @SergeyBiryukov
12 years ago

  • Component changed from Query to Users

Related: #23045

#8 @wonderboymusic
12 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 25331:

Support orderby => meta_value in WP_User_Query. Adds unit test.

Props wpsmith.
Fixes #21581.

#9 @ocean90
11 years ago

  • Type changed from defect (bug) to enhancement

#10 @christinecooper
11 years ago

The patch that was added to this ticket 2 years ago, will this be added to the next upgrade of Wordpress or will I need to change the core files manually upon every upgrade?

Version 0, edited 11 years ago by christinecooper (next)
Note: See TracTickets for help on using tickets.