I18N: Don't initialize `WP_Locale_Switcher` in `wp_load_translations_early()`.
`wp_load_translations_early()` is used when WordPress isn't fully initialized. Therefore using the `WP_Locale_Switcher` with `get_locale()`/`get_user_locale()` can cause PHP fatal errors. This reverts [38976] and [38977], and instead removes `WP_Locale_Switcher` from `wp_load_translations_early()`. See #29783. Fixes #38535. Built from https://develop.svn.wordpress.org/trunk@39005 git-svn-id: http://core.svn.wordpress.org/trunk@38947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
67bd634b69
commit
a1d18b7b8a
|
@ -50,16 +50,6 @@ function get_locale() {
|
|||
$locale = WPLANG;
|
||||
}
|
||||
|
||||
// If $wpdb hasn't been initialised yet, we can only return what we have.
|
||||
if ( ! $wpdb ) {
|
||||
if ( ! $locale ) {
|
||||
$locale = 'en_US';
|
||||
}
|
||||
|
||||
/** This filter is documented in wp-includes/l10n.php */
|
||||
return apply_filters( 'locale', $locale );
|
||||
}
|
||||
|
||||
// If multisite, check options.
|
||||
if ( is_multisite() ) {
|
||||
// Don't check blog option when installing.
|
||||
|
|
|
@ -917,8 +917,6 @@ function wp_load_translations_early() {
|
|||
}
|
||||
|
||||
$wp_locale = new WP_Locale();
|
||||
$wp_locale_switcher = new WP_Locale_Switcher();
|
||||
$wp_locale_switcher->init();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.7-beta1-39004';
|
||||
$wp_version = '4.7-beta1-39005';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue