WP_Locale_Switcher::filter_locale()publicWP 4.7.0

Filters the locale of the WordPress installation.

Method of the class: WP_Locale_Switcher{}

No Hooks.

Return

String. The locale currently being switched to.

Usage

$WP_Locale_Switcher = new WP_Locale_Switcher();
$WP_Locale_Switcher->filter_locale( $locale );
$locale(string) (required)
The locale of the WordPress installation.

Changelog

Since 4.7.0 Introduced.

WP_Locale_Switcher::filter_locale() code WP 6.5.2

public function filter_locale( $locale ) {
	$switched_locale = $this->get_switched_locale();

	if ( $switched_locale ) {
		return $switched_locale;
	}

	return $locale;
}