[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
Sat Nov 5 21:42:10 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: accepted
Priority: normal | Milestone: 6.1.1
Component: Users | Version: 6.1
Severity: major | Resolution:
Keywords: has-patch has-testing-info | Focuses:
----------------------------------------+--------------------------------
Comment (by SergeyBiryukov):
Replying to [comment:16 TimothyBlynJacobs]:
> I’d love your opinions about implementing a doing it wrong notice here.
I think plugins ideally wouldn’t be doing user queries before
`plugins_loaded` even prior to the change in 6.1. For instance, plugins
also wouldn’t get an opportunity to register necessary filters.
>
> However, I could see MU-Plugins needing to make early queries anyways.
Hmm, MU-plugins is a good point. Still, I strongly agree with not running
anything before `plugins_loaded`.
Only a few things happen between `muplugins_loaded` and `plugins_loaded`:
* Cookie and SSL constants are defined.
* Initial post types and taxonomies are created.
* Default theme directory root is registered.
* Recovery mode is initialized (for single sites).
* Pluggable functions are loaded.
So I would say that even for a MU-plugin, it should be recommended to wait
until `plugins_loaded` before runnning any queries.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56952#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list