get_locale_stylesheet_uri

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

WordPress Version: 6.1

/**
 * Retrieves the localized stylesheet URI.
 *
 * The stylesheet directory for the localized stylesheet files are located, by
 * default, in the base theme directory. The name of the locale file will be the
 * locale followed by '.css'. If that does not exist, then the text direction
 * stylesheet will be checked for existence, for example 'ltr.css'.
 *
 * The theme may change the location of the stylesheet directory by either using
 * the {@see 'stylesheet_directory_uri'} or {@see 'locale_stylesheet_uri'} filters.
 *
 * If you want to change the location of the stylesheet files for the entire
 * WordPress workflow, then change the former. If you just have the locale in a
 * separate folder, then change the latter.
 *
 * @since 2.1.0
 *
 * @global WP_Locale $wp_locale WordPress date and time locale object.
 *
 * @return string URI to active theme's localized stylesheet.
 */
function get_locale_stylesheet_uri()
{
    global $wp_locale;
    $stylesheet_dir_uri = get_stylesheet_directory_uri();
    $dir = get_stylesheet_directory();
    $locale = get_locale();
    if (file_exists("{$dir}/{$locale}.css")) {
        $stylesheet_uri = "{$stylesheet_dir_uri}/{$locale}.css";
    } elseif (!empty($wp_locale->text_direction) && file_exists("{$dir}/{$wp_locale->text_direction}.css")) {
        $stylesheet_uri = "{$stylesheet_dir_uri}/{$wp_locale->text_direction}.css";
    } else {
        $stylesheet_uri = '';
    }
    /**
     * Filters the localized stylesheet URI.
     *
     * @since 2.1.0
     *
     * @param string $stylesheet_uri     Localized stylesheet URI.
     * @param string $stylesheet_dir_uri Stylesheet directory URI.
     */
    return apply_filters('locale_stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri);
}

WordPress Version: 5.5

/**
 * Retrieves the localized stylesheet URI.
 *
 * The stylesheet directory for the localized stylesheet files are located, by
 * default, in the base theme directory. The name of the locale file will be the
 * locale followed by '.css'. If that does not exist, then the text direction
 * stylesheet will be checked for existence, for example 'ltr.css'.
 *
 * The theme may change the location of the stylesheet directory by either using
 * the {@see 'stylesheet_directory_uri'} or {@see 'locale_stylesheet_uri'} filters.
 *
 * If you want to change the location of the stylesheet files for the entire
 * WordPress workflow, then change the former. If you just have the locale in a
 * separate folder, then change the latter.
 *
 * @since 2.1.0
 *
 * @global WP_Locale $wp_locale WordPress date and time locale object.
 *
 * @return string URI to current theme's localized stylesheet.
 */
function get_locale_stylesheet_uri()
{
    global $wp_locale;
    $stylesheet_dir_uri = get_stylesheet_directory_uri();
    $dir = get_stylesheet_directory();
    $locale = get_locale();
    if (file_exists("{$dir}/{$locale}.css")) {
        $stylesheet_uri = "{$stylesheet_dir_uri}/{$locale}.css";
    } elseif (!empty($wp_locale->text_direction) && file_exists("{$dir}/{$wp_locale->text_direction}.css")) {
        $stylesheet_uri = "{$stylesheet_dir_uri}/{$wp_locale->text_direction}.css";
    } else {
        $stylesheet_uri = '';
    }
    /**
     * Filters the localized stylesheet URI.
     *
     * @since 2.1.0
     *
     * @param string $stylesheet_uri     Localized stylesheet URI.
     * @param string $stylesheet_dir_uri Stylesheet directory URI.
     */
    return apply_filters('locale_stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri);
}

WordPress Version: 5.3

/**
 * Retrieves the localized stylesheet URI.
 *
 * The stylesheet directory for the localized stylesheet files are located, by
 * default, in the base theme directory. The name of the locale file will be the
 * locale followed by '.css'. If that does not exist, then the text direction
 * stylesheet will be checked for existence, for example 'ltr.css'.
 *
 * The theme may change the location of the stylesheet directory by either using
 * the {@see 'stylesheet_directory_uri'} or {@see 'locale_stylesheet_uri'} filters.
 *
 * If you want to change the location of the stylesheet files for the entire
 * WordPress workflow, then change the former. If you just have the locale in a
 * separate folder, then change the latter.
 *
 * @since 2.1.0
 *
 * @global WP_Locale $wp_locale WordPress date and time locale object.
 *
 * @return string
 */
function get_locale_stylesheet_uri()
{
    global $wp_locale;
    $stylesheet_dir_uri = get_stylesheet_directory_uri();
    $dir = get_stylesheet_directory();
    $locale = get_locale();
    if (file_exists("{$dir}/{$locale}.css")) {
        $stylesheet_uri = "{$stylesheet_dir_uri}/{$locale}.css";
    } elseif (!empty($wp_locale->text_direction) && file_exists("{$dir}/{$wp_locale->text_direction}.css")) {
        $stylesheet_uri = "{$stylesheet_dir_uri}/{$wp_locale->text_direction}.css";
    } else {
        $stylesheet_uri = '';
    }
    /**
     * Filters the localized stylesheet URI.
     *
     * @since 2.1.0
     *
     * @param string $stylesheet_uri     Localized stylesheet URI.
     * @param string $stylesheet_dir_uri Stylesheet directory URI.
     */
    return apply_filters('locale_stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri);
}

WordPress Version: 4.6

/**
 * Retrieves the localized stylesheet URI.
 *
 * The stylesheet directory for the localized stylesheet files are located, by
 * default, in the base theme directory. The name of the locale file will be the
 * locale followed by '.css'. If that does not exist, then the text direction
 * stylesheet will be checked for existence, for example 'ltr.css'.
 *
 * The theme may change the location of the stylesheet directory by either using
 * the {@see 'stylesheet_directory_uri'} or {@see 'locale_stylesheet_uri'} filters.
 *
 * If you want to change the location of the stylesheet files for the entire
 * WordPress workflow, then change the former. If you just have the locale in a
 * separate folder, then change the latter.
 *
 * @since 2.1.0
 *
 * @global WP_Locale $wp_locale
 *
 * @return string
 */
function get_locale_stylesheet_uri()
{
    global $wp_locale;
    $stylesheet_dir_uri = get_stylesheet_directory_uri();
    $dir = get_stylesheet_directory();
    $locale = get_locale();
    if (file_exists("{$dir}/{$locale}.css")) {
        $stylesheet_uri = "{$stylesheet_dir_uri}/{$locale}.css";
    } elseif (!empty($wp_locale->text_direction) && file_exists("{$dir}/{$wp_locale->text_direction}.css")) {
        $stylesheet_uri = "{$stylesheet_dir_uri}/{$wp_locale->text_direction}.css";
    } else {
        $stylesheet_uri = '';
    }
    /**
     * Filters the localized stylesheet URI.
     *
     * @since 2.1.0
     *
     * @param string $stylesheet_uri     Localized stylesheet URI.
     * @param string $stylesheet_dir_uri Stylesheet directory URI.
     */
    return apply_filters('locale_stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri);
}

WordPress Version: 4.3

/**
 * Retrieve localized stylesheet URI.
 *
 * The stylesheet directory for the localized stylesheet files are located, by
 * default, in the base theme directory. The name of the locale file will be the
 * locale followed by '.css'. If that does not exist, then the text direction
 * stylesheet will be checked for existence, for example 'ltr.css'.
 *
 * The theme may change the location of the stylesheet directory by either using
 * the 'stylesheet_directory_uri' filter or the 'locale_stylesheet_uri' filter.
 * If you want to change the location of the stylesheet files for the entire
 * WordPress workflow, then change the former. If you just have the locale in a
 * separate folder, then change the latter.
 *
 * @since 2.1.0
 *
 * @global WP_Locale $wp_locale
 *
 * @return string
 */
function get_locale_stylesheet_uri()
{
    global $wp_locale;
    $stylesheet_dir_uri = get_stylesheet_directory_uri();
    $dir = get_stylesheet_directory();
    $locale = get_locale();
    if (file_exists("{$dir}/{$locale}.css")) {
        $stylesheet_uri = "{$stylesheet_dir_uri}/{$locale}.css";
    } elseif (!empty($wp_locale->text_direction) && file_exists("{$dir}/{$wp_locale->text_direction}.css")) {
        $stylesheet_uri = "{$stylesheet_dir_uri}/{$wp_locale->text_direction}.css";
    } else {
        $stylesheet_uri = '';
    }
    /**
     * Filter the localized stylesheet URI.
     *
     * @since 2.1.0
     *
     * @param string $stylesheet_uri     Localized stylesheet URI.
     * @param string $stylesheet_dir_uri Stylesheet directory URI.
     */
    return apply_filters('locale_stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri);
}

WordPress Version: 3.8

/**
 * Retrieve localized stylesheet URI.
 *
 * The stylesheet directory for the localized stylesheet files are located, by
 * default, in the base theme directory. The name of the locale file will be the
 * locale followed by '.css'. If that does not exist, then the text direction
 * stylesheet will be checked for existence, for example 'ltr.css'.
 *
 * The theme may change the location of the stylesheet directory by either using
 * the 'stylesheet_directory_uri' filter or the 'locale_stylesheet_uri' filter.
 * If you want to change the location of the stylesheet files for the entire
 * WordPress workflow, then change the former. If you just have the locale in a
 * separate folder, then change the latter.
 *
 * @since 2.1.0
 *
 * @return string
 */
function get_locale_stylesheet_uri()
{
    global $wp_locale;
    $stylesheet_dir_uri = get_stylesheet_directory_uri();
    $dir = get_stylesheet_directory();
    $locale = get_locale();
    if (file_exists("{$dir}/{$locale}.css")) {
        $stylesheet_uri = "{$stylesheet_dir_uri}/{$locale}.css";
    } elseif (!empty($wp_locale->text_direction) && file_exists("{$dir}/{$wp_locale->text_direction}.css")) {
        $stylesheet_uri = "{$stylesheet_dir_uri}/{$wp_locale->text_direction}.css";
    } else {
        $stylesheet_uri = '';
    }
    /**
     * Filter the localized stylesheet URI.
     *
     * @since 2.1.0
     *
     * @param string $stylesheet_uri     Localized stylesheet URI.
     * @param string $stylesheet_dir_uri Stylesheet directory URI.
     */
    return apply_filters('locale_stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri);
}

WordPress Version: 3.7

/**
 * Retrieve localized stylesheet URI.
 *
 * The stylesheet directory for the localized stylesheet files are located, by
 * default, in the base theme directory. The name of the locale file will be the
 * locale followed by '.css'. If that does not exist, then the text direction
 * stylesheet will be checked for existence, for example 'ltr.css'.
 *
 * The theme may change the location of the stylesheet directory by either using
 * the 'stylesheet_directory_uri' filter or the 'locale_stylesheet_uri' filter.
 * If you want to change the location of the stylesheet files for the entire
 * WordPress workflow, then change the former. If you just have the locale in a
 * separate folder, then change the latter.
 *
 * @since 2.1.0
 * @uses apply_filters() Calls 'locale_stylesheet_uri' filter on stylesheet URI path and stylesheet directory URI.
 *
 * @return string
 */
function get_locale_stylesheet_uri()
{
    global $wp_locale;
    $stylesheet_dir_uri = get_stylesheet_directory_uri();
    $dir = get_stylesheet_directory();
    $locale = get_locale();
    if (file_exists("{$dir}/{$locale}.css")) {
        $stylesheet_uri = "{$stylesheet_dir_uri}/{$locale}.css";
    } elseif (!empty($wp_locale->text_direction) && file_exists("{$dir}/{$wp_locale->text_direction}.css")) {
        $stylesheet_uri = "{$stylesheet_dir_uri}/{$wp_locale->text_direction}.css";
    } else {
        $stylesheet_uri = '';
    }
    return apply_filters('locale_stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri);
}