restore_current_locale

函式
restore_current_locale ( No parameters )
返回值
  • (string|false) Locale on success, false on error.
定義位置
相關方法
restore_current_blogrestore_previous_localeset_current_screenget_current_screenget_user_locale
引入
4.7.0
棄用
-

restore_current_locale: 這是一個WordPress的函式,在臨時切換到一個不同的locale後,恢復當前的locale。一個locale是一組引數,定義了使用者的語言、國家和文化偏好。WordPress使用locale來向使用者顯示本地化的內容和資訊: 當使用者切換到一個不同的locale時,WordPress使用新的locale來顯示內容。要切換回原來的locale,要呼叫repare_current_locale來恢復原來的locale。

根據原始的語言環境恢復譯文。

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

	return $wp_locale_switcher->restore_current_locale();
}

常見問題

FAQs
檢視更多 >