[wp-trac] [WordPress Trac] #55594: Prime user meta in WP_User_Query

WordPress Trac noreply at wordpress.org
Tue Jul 5 09:26:37 UTC 2022

#55594: Prime user meta in WP_User_Query
 Reporter:  spacedmonkey                     |       Owner:  spacedmonkey
     Type:  enhancement                      |      Status:  closed
 Priority:  normal                           |   Milestone:  6.1
Component:  Users                            |     Version:  3.0
 Severity:  normal                           |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests commit  |     Focuses:  performance
Changes (by spacedmonkey):

 * status:  assigned => closed
 * resolution:   => fixed


 In [changeset:"53655" 53655]:
 #!CommitTicketReference repository="" revision="53655"
 Users: Prime user meta in `WP_User_Query` class.

 When querying 'fields' equal to 'all' using the `WP_User_Query` class,
 this returns an array of `WP_User` objects. A `WP_User` object requires
 user meta to be primed, as the user's role is stored in user meta. Ensure
 that all users meta is primed in a single request by calling the
 `cache_users` function when querying 'fields' equal to 'all'. Soft
 deprecate fields equal to `all_with_meta` as it now acts the same as
 'fields' equal to 'all'.

 Props Spacedmonkey, peterwilsoncc, mehulkaklotar, timothyblynjacobs,
 Fixes #55594.

Ticket URL: <https://core.trac.wordpress.org/ticket/55594#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list