WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#15791 closed defect (bug) (fixed)

wp_dropdown_users ignores defaults

Reported by: duck_ Owned by:
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.1
Component: General Keywords: has-patch
Focuses: Cc:

Description

wp_dropdown_users no longer orders results by display_name by default, because only the $args array passed to the function is used to determine which users to include.

Steps to reproduce

Have two users:

User 1: login = aaaa, display name = zzzz
User 2: login = zzzz, display name = aaaa

Call wp_dropdown_users. Expect User 2 to be displayed first, but actually ordered by login.

Two patches attached, use $r in get_users call and either set default to name or allow display_name in WP_User_Query. v2 is probably more backwards compatible (raises the question of backwards compatibility of other orderby values, e.g. just "email" now instead of "user_email". Also, the codex suggests "user_nicename" as a valid orderby value, but it looks like this, or "nicename", doesn't even work with WP_User_Query).

Attachments (2)

15791.diff (2.2 KB) - added by duck_ 3 years ago.
15791.v2.diff (2.2 KB) - added by duck_ 3 years ago.

Download all attachments as: .zip

Change History (3)

duck_3 years ago

duck_3 years ago

comment:1 ryan3 years ago

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

(In [16916]) Honor defaults in wp_dropdown_users(). Props duck_. fixes #15791

Note: See TracTickets for help on using tickets.