[wp-trac] [WordPress Trac] #43869: Do not initialize current user too early in `get_user_locale()`
WordPress Trac
noreply at wordpress.org
Fri Dec 6 09:02:16 UTC 2024
#43869: Do not initialize current user too early in `get_user_locale()`
-------------------------------------------------+-------------------------
Reporter: flixos90 | Owner:
| SergeyBiryukov
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: Future
| Release
Component: Bootstrap/Load | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests 2nd- | Focuses:
opinion |
-------------------------------------------------+-------------------------
Comment (by swissspidy):
#62393 suggested adding a `_doing_it_wrong` notice in
`_wp_get_current_user` if initializing the user too early. That sounds
interesting to me and worth adding as part of this, to prevent plugins
from doing it wrong.
The translation issue is ''mostly'' mitigated now, but in wp-admin the
user is still initialized early-ish because it calls `get_user_locale()`.
It happens here:
https://github.com/WordPress/wordpress-
develop/blob/d45a119a9e04073fceb802eda36f8ca4319a9710/src/wp-
settings.php#L654-L655
The question is: is that too early?
On the frontend, it happens right before `init`, as expected:
https://github.com/WordPress/wordpress-
develop/blob/d45a119a9e04073fceb802eda36f8ca4319a9710/src/wp-
settings.php#L708-L709
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43869#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list