determine_locale

The timeline below displays how wordpress function determine_locale has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.5

/**
 * Determines the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow The filename of the current screen.
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null $locale The locale to return and short-circuit. Default null.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if ($determined_locale && is_string($determined_locale)) {
        return $determined_locale;
    }
    if (isset($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow'] && (!empty($_GET['wp_lang']) || !empty($_COOKIE['wp_lang']))) {
        if (!empty($_GET['wp_lang'])) {
            $determined_locale = sanitize_locale_name($_GET['wp_lang']);
        } else {
            $determined_locale = sanitize_locale_name($_COOKIE['wp_lang']);
        }
    } elseif (is_admin() || isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    } elseif ((!empty($_REQUEST['language']) || isset($GLOBALS['wp_local_package'])) && wp_installing()) {
        if (!empty($_REQUEST['language'])) {
            $determined_locale = sanitize_locale_name($_REQUEST['language']);
        } else {
            $determined_locale = $GLOBALS['wp_local_package'];
        }
    }
    if (!$determined_locale) {
        $determined_locale = get_locale();
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $determined_locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: 6.3

/**
 * Determines the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow The filename of the current screen.
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null $locale The locale to return and short-circuit. Default null.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if ($determined_locale && is_string($determined_locale)) {
        return $determined_locale;
    }
    if (isset($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow'] && (!empty($_GET['wp_lang']) || !empty($_COOKIE['wp_lang']))) {
        if (!empty($_GET['wp_lang'])) {
            $determined_locale = sanitize_locale_name($_GET['wp_lang']);
        } else {
            $determined_locale = sanitize_locale_name($_COOKIE['wp_lang']);
        }
    } elseif (is_admin() || isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!$determined_locale) {
        $determined_locale = get_locale();
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: 2.1

/**
 * Determines the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow The filename of the current screen.
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null $locale The locale to return and short-circuit. Default null.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    $wp_lang = '';
    if (!empty($_GET['wp_lang'])) {
        $wp_lang = sanitize_locale_name(wp_unslash($_GET['wp_lang']));
    } elseif (!empty($_COOKIE['wp_lang'])) {
        $wp_lang = sanitize_locale_name(wp_unslash($_COOKIE['wp_lang']));
    }
    if (!empty($wp_lang) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = $wp_lang;
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: 6.2

/**
 * Determines the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow The filename of the current screen.
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null $locale The locale to return and short-circuit. Default null.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    $wp_lang = '';
    if (!empty($_GET['wp_lang'])) {
        $wp_lang = sanitize_text_field($_GET['wp_lang']);
    } elseif (!empty($_COOKIE['wp_lang'])) {
        $wp_lang = sanitize_text_field($_COOKIE['wp_lang']);
    }
    if (!empty($wp_lang) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = $wp_lang;
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: 1.2

/**
 * Determines the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow The filename of the current screen.
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null $locale The locale to return and short-circuit. Default null.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    $wp_lang = '';
    if (!empty($_GET['wp_lang'])) {
        $wp_lang = sanitize_locale_name(wp_unslash($_GET['wp_lang']));
    } elseif (!empty($_COOKIE['wp_lang'])) {
        $wp_lang = sanitize_locale_name(wp_unslash($_COOKIE['wp_lang']));
    }
    if (!empty($wp_lang) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = $wp_lang;
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: 6.1

/**
 * Determines the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow The filename of the current screen.
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null $locale The locale to return and short-circuit. Default null.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    $wp_lang = '';
    if (!empty($_GET['wp_lang'])) {
        $wp_lang = sanitize_text_field($_GET['wp_lang']);
    } elseif (!empty($_COOKIE['wp_lang'])) {
        $wp_lang = sanitize_text_field($_COOKIE['wp_lang']);
    }
    if (!empty($wp_lang) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = $wp_lang;
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: 9.6

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null $locale The locale to return and short-circuit. Default null.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    $wp_lang = '';
    if (!empty($_GET['wp_lang'])) {
        $wp_lang = sanitize_locale_name(wp_unslash($_GET['wp_lang']));
    } elseif (!empty($_COOKIE['wp_lang'])) {
        $wp_lang = sanitize_locale_name(wp_unslash($_COOKIE['wp_lang']));
    }
    if (!empty($wp_lang) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = $wp_lang;
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: 5.9

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null $locale The locale to return and short-circuit. Default null.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    $wp_lang = '';
    if (!empty($_GET['wp_lang'])) {
        $wp_lang = sanitize_text_field($_GET['wp_lang']);
    } elseif (!empty($_COOKIE['wp_lang'])) {
        $wp_lang = sanitize_text_field($_COOKIE['wp_lang']);
    }
    if (!empty($wp_lang) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = $wp_lang;
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: 8.7

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null $locale The locale to return and short-circuit. Default null.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_locale_name(wp_unslash($_GET['wp_lang']));
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: 5.8

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null $locale The locale to return and short-circuit. Default null.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_text_field($_GET['wp_lang']);
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: 7.9

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null $locale The locale to return and short-circuit. Default null.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_locale_name(wp_unslash($_GET['wp_lang']));
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: 7.2

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null $locale The locale to return and short-circuit. Default null.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_text_field($_GET['wp_lang']);
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: .10

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null $locale The locale to return and short-circuit. Default null.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_locale_name(wp_unslash($_GET['wp_lang']));
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: 6.2

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null $locale The locale to return and short-circuit. Default null.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_text_field($_GET['wp_lang']);
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: .11

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null $locale The locale to return and short-circuit. Default null.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_locale_name(wp_unslash($_GET['wp_lang']));
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: 5.2

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null $locale The locale to return and short-circuit. Default null.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_text_field($_GET['wp_lang']);
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: .12

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null $locale The locale to return and short-circuit. Default null.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_locale_name(wp_unslash($_GET['wp_lang']));
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: 4.2

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null $locale The locale to return and short-circuit. Default null.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_text_field($_GET['wp_lang']);
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: .13

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null $locale The locale to return and short-circuit. Default null.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_locale_name(wp_unslash($_GET['wp_lang']));
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: 5.4

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null $locale The locale to return and short-circuit. Default null.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_text_field($_GET['wp_lang']);
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: 3.2

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null The locale to return and short-circuit, or null as default.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_text_field($_GET['wp_lang']);
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: .15

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null The locale to return and short-circuit, or null as default.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_locale_name(wp_unslash($_GET['wp_lang']));
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: 2.3

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null The locale to return and short-circuit, or null as default.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_text_field($_GET['wp_lang']);
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: .20

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null The locale to return and short-circuit, or null as default.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_locale_name(wp_unslash($_GET['wp_lang']));
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: 2.2

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null The locale to return and short-circuit, or null as default.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_text_field($_GET['wp_lang']);
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: .18

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null The locale to return and short-circuit, or null as default.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_locale_name(wp_unslash($_GET['wp_lang']));
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: 1.2

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null The locale to return and short-circuit, or null as default.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_text_field($_GET['wp_lang']);
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: .16

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null The locale to return and short-circuit, or null as default.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_locale_name(wp_unslash($_GET['wp_lang']));
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: 0.3

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null The locale to return and short-circuit, or null as default.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_text_field($_GET['wp_lang']);
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: .20

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null The locale to return and short-circuit, or null as default.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_locale_name(wp_unslash($_GET['wp_lang']));
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: 0.2

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null The locale to return and short-circuit, or null as default.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_text_field($_GET['wp_lang']);
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: .19

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null The locale to return and short-circuit, or null as default.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_locale_name(wp_unslash($_GET['wp_lang']));
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: .10

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null The locale to return and short-circuit, or null as default.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && !empty($GLOBALS['pagenow']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_text_field($_GET['wp_lang']);
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}

WordPress Version: 5.0

/**
 * Determine the current locale desired for the request.
 *
 * @since 5.0.0
 *
 * @global string $pagenow
 *
 * @return string The determined locale.
 */
function determine_locale()
{
    /**
     * Filters the locale for the current request prior to the default determination process.
     *
     * Using this filter allows to override the default logic, effectively short-circuiting the function.
     *
     * @since 5.0.0
     *
     * @param string|null The locale to return and short-circuit, or null as default.
     */
    $determined_locale = apply_filters('pre_determine_locale', null);
    if (!empty($determined_locale) && is_string($determined_locale)) {
        return $determined_locale;
    }
    $determined_locale = get_locale();
    if (is_admin()) {
        $determined_locale = get_user_locale();
    }
    if (isset($_GET['_locale']) && 'user' === $_GET['_locale'] && wp_is_json_request()) {
        $determined_locale = get_user_locale();
    }
    if (!empty($_GET['wp_lang']) && 'wp-login.php' === $GLOBALS['pagenow']) {
        $determined_locale = sanitize_text_field($_GET['wp_lang']);
    }
    /**
     * Filters the locale for the current request.
     *
     * @since 5.0.0
     *
     * @param string $locale The locale.
     */
    return apply_filters('determine_locale', $determined_locale);
}