WP_Locale_Switcher::is_switched() WordPress Method

The WP_Locale_Switcher::is_switched() function allows you to check if the locale has been switched for the current request. This can be useful for conditionally loading language-specific resources.

WP_Locale_Switcher::is_switched() #

Whether switch_to_locale() is in effect.


Return

(bool) True if the locale has been switched, false otherwise.


Top ↑

Source

File: wp-includes/class-wp-locale-switcher.php

	public function is_switched() {
		return ! empty( $this->locales );
	}


Top ↑

Changelog

Changelog
VersionDescription
4.7.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.