WordPress.org

Make WordPress Core

Changeset 43846


Ignore:
Timestamp:
10/31/2018 02:32:49 AM (13 months ago)
Author:
danielbachhuber
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0/src/wp-includes/l10n.php

    r43827 r43846  
    135135    }
    136136
    137     if ( isset( $_GET['_locale'] ) && 'user' === $_GET['_locale'] && wp_is_json_request() && is_user_logged_in() ) {
     137    if ( isset( $_GET['_locale'] ) && 'user' === $_GET['_locale'] && wp_is_json_request() ) {
    138138        $determined_locale = get_user_locale();
    139139    }
Note: See TracChangeset for help on using the changeset viewer.