WP_Customize_Manager loads the current user too early
|Reported by:||johnjamesjacoby||Owned by:|
When previewing a theme, neither the locale nor the functions.php of either parent/child themes have had the opportunity to load ahead of the current user. This causes theme previews to load without translations in multisite setups where the user chooses their own language, and also means any theme that modifies the current user via actions or filters never has the chance to hook in in time.
The problem is introduced when WP_Customize_Manager prematurely calls is_user_logged_in() and current_user_can() before $wp->init() has fired, on the 'setup_theme' action.
From what I can tell, these specific checks can be moved into a new method, hooked to init, without any consequence. They are only responsible for maybe calling wp_die() where appropriate, meaning any past or subsequent actions or execution are irrelevant anyways.
Patch attached fixes this issue by adding an init() method to the WP_Customize_Manager class, and moves the user checks into this method.
Change History (29)
in reply to:
4 years ago
8 months ago
- Keywords close added
- Owner westonruter deleted
- Status changed from accepted to assigned
6 months ago
- Milestone Future Release deleted
- Resolution set to wontfix
- Status changed from assigned to closed
6 months ago
- Keywords close removed
- Milestone set to Awaiting Review
- Resolution wontfix deleted
- Status changed from closed to reopened