l10n: Avoid calling `is_user_logged_in()` in `determine_locale()`.

`is_user_logged_in()` is a pluggable function, and loaded after plugins are loaded. If a plugin calls `__()` too early, `is_user_logged_in()` is missing and WordPress will fatal. `get_user_locale()` already handles this scenario for us, so it's safe to rely on exclusively.

See #44758.
Fixes #45235.

Built from https://develop.svn.wordpress.org/branches/5.0@43846


git-svn-id: http://core.svn.wordpress.org/branches/5.0@43675 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
danielbachhuber 2018-10-31 02:33:53 +00:00
parent f21fbee21b
commit bb2de34edb
2 changed files with 2 additions and 2 deletions

View File

@ -134,7 +134,7 @@ function determine_locale() {
$determined_locale = get_user_locale(); $determined_locale = get_user_locale();
} }
if ( isset( $_GET['_locale'] ) && 'user' === $_GET['_locale'] && wp_is_json_request() && is_user_logged_in() ) { if ( isset( $_GET['_locale'] ) && 'user' === $_GET['_locale'] && wp_is_json_request() ) {
$determined_locale = get_user_locale(); $determined_locale = get_user_locale();
} }

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.0-beta2-43845'; $wp_version = '5.0-beta2-43846';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.