is_locale_switched()WP 4.7.0

Whether switch_to_locale() is in effect.

1 time — 0.000019 sec (very fast) | 50000 times — 0.02 sec (speed of light) | PHP 7.0.14, WP 4.7

No Hooks.

Return

true|false. True if the locale has been switched, false otherwise.

Usage

is_locale_switched();

Notes

  • Global. WP_Locale_Switcher. $wp_locale_switcher WordPress locale switcher object.

Changelog

Since 4.7.0 Introduced.

Code of is_locale_switched() WP 5.9.3

function is_locale_switched() {
	/* @var WP_Locale_Switcher $wp_locale_switcher */
	global $wp_locale_switcher;

	return $wp_locale_switcher->is_switched();
}