From fca28f6b85b619992f04fd1b773a39a1bfca4368 Mon Sep 17 00:00:00 2001 From: Anton Timmermans Date: Fri, 14 Dec 2018 12:14:15 +0000 Subject: [PATCH] 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. Props danielbachhuber. Merges [43846] to trunk. See #44758. Fixes #45235. git-svn-id: https://develop.svn.wordpress.org/trunk@44181 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/l10n.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/l10n.php b/src/wp-includes/l10n.php index 3705f46f23..229c3bbb25 100644 --- a/src/wp-includes/l10n.php +++ b/src/wp-includes/l10n.php @@ -134,7 +134,7 @@ function determine_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(); }