[wp-trac] [WordPress Trac] #46451: wp_dropdown_users() does not pass all applicable arguments on to get_users()

WordPress Trac noreply at wordpress.org
Fri Mar 8 23:17:09 UTC 2019


#46451: wp_dropdown_users() does not pass all applicable arguments on to
get_users()
--------------------------+-----------------------------
 Reporter:  pbiron        |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Users         |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 The docs for `wp_dropdown_users()` say of the `$args` param:

   Array or string of arguments to generate a drop-down of users.
   See WP_User_Query::prepare_query() for additional available arguments.

 However, not **every** argument accepted by
 `WP_User_Query::prepare_query()` is passed on to `get_users()`: there is a
 specific whitelist, and some very useful args are not included in that
 whitelist (e.g., `meta_query`).

 Instead, the arguments used by `wp_dropdown_users()` for generating the
 HTML markup of the dropdown should simply be removed from `$args` and
 anything left over should be passed to `get_users()`.

 Not only would this bring the behavior of `wp_dropdown_users()` into
 conformance with its docs, it would have the added benefit of future
 proofing it: if a future release adds  additional args to `get_users()`,
 the whitelist in `wp_dropdown_users()` wouldn't have to be adjusted to
 accept them.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46451>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list