is_locale_switched

函式
is_locale_switched ( No parameters )
返回值
  • (bool) True if the locale has been switched, false otherwise.
定義位置
相關方法
is_local_attachmentms_is_switchedlocale_stylesheetis_main_sitecheck_theme_switched
引入
4.7.0
棄用
-

is_locale_switched: 這個函式檢查區域設定是否被切換了。WordPress支援多語言,這個函式檢查使用者是否切換到不同的語言。

確定 switch_to_locale() 是否生效。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function is_locale_switched() {
/* @var WP_Locale_Switcher $wp_locale_switcher */
global $wp_locale_switcher;
return $wp_locale_switcher->is_switched();
}
function is_locale_switched() { /* @var WP_Locale_Switcher $wp_locale_switcher */ global $wp_locale_switcher; return $wp_locale_switcher->is_switched(); }
function is_locale_switched() {
	/* @var WP_Locale_Switcher $wp_locale_switcher */
	global $wp_locale_switcher;

	return $wp_locale_switcher->is_switched();
}

常見問題

FAQs
檢視更多 >