Skip to content

Commit

Permalink
Core checks that the init hook is complete before trying to use the g…
Browse files Browse the repository at this point in the history
…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)
  • Loading branch information
ramonjd committed Jan 29, 2024
1 parent 58354c3 commit fa802d1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/compat/wordpress-6.4/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @param WP_Scripts $scripts WP_Scripts object.
*/
function gutenberg_update_wp_date_settings( $scripts ) {
if ( $scripts->query( 'wp-date', 'registered' ) ) {
if ( did_action( 'init' ) && $scripts->query( 'wp-date', 'registered' ) ) {
global $wp_locale;
// Calculate the timezone abbr (EDT, PST) if possible.
$timezone_string = get_option( 'timezone_string', 'UTC' );
Expand Down

0 comments on commit fa802d1

Please sign in to comment.