[wp-trac] [WordPress Trac] #53177: WP_User_Query does not accept fields as string except ID

WordPress Trac noreply at wordpress.org
Mon Apr 25 12:42:12 UTC 2022


#53177: WP_User_Query does not accept fields as string except ID
-------------------------------------------------+-------------------------
 Reporter:  rilwis                               |       Owner:  audrasjb
     Type:  defect (bug)                         |      Status:  accepted
 Priority:  normal                               |   Milestone:  6.0
Component:  Users                                |     Version:  4.4
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests has-        |     Focuses:  docs
  testing-info commit assigned-for-commit        |
-------------------------------------------------+-------------------------
Changes (by audrasjb):

 * keywords:  has-patch has-unit-tests has-testing-info needs-testing =>
     has-patch has-unit-tests has-testing-info commit assigned-for-commit
 * owner:  (none) => audrasjb
 * status:  new => accepted


Comment:

 Tested with a fresh 6.0 alpha installation, 4 users created and the
 following code:
 {{{
 add_action( 'init', function() {
         $users = get_users( [
                 'fields' => 'display_name',
         ] );
         wp_die( print_r( $users ) );
 } );
 }}}

 Before patch, it returns:

 {{{
 Array (
   [0] => 3
   [1] => 1
   [2] => 2
   [3] => 4
 )
 }}}

 After patch:
 {{{
 Array (
   [0] => Jack
   [1] => jb
   [2] => momo
   [3] => Roberta
 )
 }}}

 Marking as good for commit.

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


More information about the wp-trac mailing list