-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Script loader 6.4 compat: check for init hook completion #58406
Conversation
…lobal $wp_locale value in wp_default_packages_inline_scripts, which is where the date settings are set for inline JS. This change backports that from Core.
This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress. If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged. If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack. Thank you! ❤️ View changed files❔ lib/compat/wordpress-6.4/script-loader.php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this up @ramonjd!
This looks like a good way to do it to me, as it follows how it's guarded in core 👍
✅ Confirmed that wp.date.getSettings()
works as before in the site editor, returning translated settings
✅ Double-checked that $wp_locale
in core is set to an instance of WP_Locale
, which sets public properties with empty arrays, so if $wp_locale
is set, then we don't need to check if the properties are arrays before accessing them
✅ Double-checked that the locale is instantiated set before init
here: https://github.com/WordPress/wordpress-develop/blob/a61525049f574a826cf20a8b1b624e1b42970b10/src/wp-settings.php#L613
LGTM! ✨
Appreciate the lightning fast review @andrewserong 🙇🏻 |
…lobal $wp_locale value in wp_default_packages_inline_scripts, which is where the date settings are set for inline JS. This change backports that from Core. (#58406)
What, why, how?
Core checks that the init hook is complete before trying to use the global
$wp_locale
value in wp_default_packages_inline_scripts, which is where the date settings are set for inline JS.This change backports that from Core.
Note
No Core backport required as the changes from #53931 were ported over in WordPress/wordpress-develop#5101
Testing Instructions
Test steps in #53931 should work as expected.