[wp-trac] [WordPress Trac] #56952: cache_users() not defined when calling get_user without field parameter or using all_with_meta or all
WordPress Trac
noreply at wordpress.org
Tue Nov 8 17:30:03 UTC 2022
#56952: cache_users() not defined when calling get_user without field parameter or
using all_with_meta or all
-----------------------------------------------+---------------------------
Reporter: carazo | Owner:
| TimothyBlynJacobs
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 6.1.1
Component: Users | Version: 6.1
Severity: major | Resolution: fixed
Keywords: has-patch has-testing-info commit | Focuses: performance
-----------------------------------------------+---------------------------
Changes (by TimothyBlynJacobs):
* status: accepted => closed
* resolution: => fixed
Comment:
In [changeset:"54766" 54766]:
{{{
#!CommitTicketReference repository="" revision="54766"
Query: Don't attempt caching if running a WP_User_Query before
plugins_loaded.
In #55594 user meta caching was enabled by default when making a
`WP_User_Query`. Previously, this was only enabled if a developer
specifically queried for 'all_with_meta'
fields. User meta caching is implemented using a pluggable function,
`cache_users`. If a plugin runs a `WP_User_Query` before pluggable
functions have been defined, this
will now cause a fatal error.
In this commit, a `function_exists` check is introduced to avoid calling
`cache_users` if it's not defined. Additionally, a `_doing_it_wrong`
notice is issued if the
`WP_User_Query::query` method is called before the 'plugins_loaded' hook.
Props carazo, subrataemfluence, oakesjosh, spacedmonkey, obenland,
SergeyBiryukov, peterwilsoncc.
Fixes #56952.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56952#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list