[wp-trac] [WordPress Trac] #22921: Allow get_users() to return array of values via 'fields' parameter

WordPress Trac noreply at wordpress.org
Mon Jun 16 15:37:14 UTC 2014


#22921: Allow get_users() to return array of values via 'fields' parameter
-------------------------------------------------+-------------------------
 Reporter:  chipbennett                          |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Future
Component:  Users                                |  Release
 Severity:  normal                               |     Version:  3.5
 Keywords:  has-patch needs-testing dev-         |  Resolution:
  feedback                                       |     Focuses:
-------------------------------------------------+-------------------------
Changes (by DrewAPicture):

 * keywords:  has-patch needs-testing => has-patch needs-testing dev-
               feedback


Comment:

 Replying to [comment:13 mbcreation]:
 > Any update on this. (since the Codex is still wrong) ?
 > Thanks.

 The Codex articles for
 [http://codex.wordpress.org/Function_Reference/get_users get_users()] and
 [http://codex.wordpress.org/Class_Reference/WP_User_Query WP_User_Query]
 have been updated to reflect that either can return an array of IDs,
 stdClass objects or WP_User objects depending on the value of the `fields`
 parameter.

 As for the purpose of the ticket, the patch as-is would constitute a
 breaking change. I think we need a lot more data on whether plugin devs
 are using the `fields` argument in this way, if so how many and how. We
 also need to determine whether that usage constitutes "doing it wrong" as
 we've unfortunately been pigeon-holing all individual fields as 'ID' this
 whole time.

 In the absence of more data, it seems like a good alternative might be to
 consider a new `output` argument (a la `get_post()`'s second parameter)
 that would set the format of the return container (an array of arrays for
 `ARRAY_A`, an array of objects for `OBJECT` (default)).

--
Ticket URL: <https://core.trac.wordpress.org/ticket/22921#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list