locale_stylesheet_uri WordPress Filter Hook

The locale_stylesheet_uri hook is used to filter the stylesheet URI for the current locale. This hook is useful for plugin and theme developers who need to target specific locales with their CSS. For example, a plugin that is only available in English may want to load a different stylesheet on English pages than on pages in other languages. This hook is called early in the WP load process, before the stylesheets are enqueued. It should be used by plugins and themes to filter the $locale_stylesheet_uri global variable. The following example shows how a plugin could use this hook to load a different stylesheet on English pages: function my_plugin_locale_stylesheet_uri( $stylesheet_uri, $locale ) { if ( $locale == 'en_US' ) { $stylesheet_uri = plugin_dir_url( __FILE__ ) . 'css/en.css'; } return $stylesheet_uri; } add_filter( 'locale_stylesheet_uri', 'my_plugin_locale_stylesheet_uri', 10, 2 );

apply_filters( 'locale_stylesheet_uri', string $stylesheet_uri, string $stylesheet_dir_uri ) #

Filters the localized stylesheet URI.


Parameters

$stylesheet_uri

(string)Localized stylesheet URI.

$stylesheet_dir_uri

(string)Stylesheet directory URI.


Top ↑

Source

File: wp-includes/theme.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
2.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More