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

WordPress Trac noreply at wordpress.org
Wed Mar 23 06:47:20 UTC 2022


#53177: WP_User_Query does not accept fields as string except ID
-------------------------------------------------+-------------------------
 Reporter:  rilwis                               |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  6.0
Component:  Users                                |     Version:  4.4
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing has-unit-    |     Focuses:  docs
  tests needs-refresh needs-testing-info         |
-------------------------------------------------+-------------------------

Comment (by rilwis):

 @hellofromTonya ,

 Here is a simple code to test:


 {{{
 add_action( 'init', function() {
         $users = get_users( [
                 'fields' => 'display_name',
         ] );
         print_r( $users ); // Expect an array of display names, but got an
 array of IDs.
 } );
 }}}

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


More information about the wp-trac mailing list