is_theme_paused

函式
is_theme_paused ( $theme )
引數
  • (string) $theme Path to the theme directory relative to the themes directory.
    Required:
返回值
  • (bool) True, if in the list of paused themes. False, not in the list.
定義位置
相關方法
add_theme_pagelist_theme_updatesis_plugin_pausedset_theme_moddisplay_themes
引入
5.2.0
棄用
-

is_theme_paused是一個WordPress的函式,檢查當前活動的主題是否暫停。如果有一個致命的錯誤或一個致命的錯誤即將發生,一個主題可以被暫停。如果主題暫停,它返回一個布林值true,否則返回false。

判斷一個主題在技術上是否處於活動狀態,但在載入時被暫停了。

關於這個和類似主題函式的更多資訊,請檢視《主題開發者手冊》中的{@link Conditional Tags}文章。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function is_theme_paused( $theme ) {
if ( ! isset( $GLOBALS['_paused_themes'] ) ) {
return false;
}
if ( get_stylesheet() !== $theme && get_template() !== $theme ) {
return false;
}
return array_key_exists( $theme, $GLOBALS['_paused_themes'] );
}
function is_theme_paused( $theme ) { if ( ! isset( $GLOBALS['_paused_themes'] ) ) { return false; } if ( get_stylesheet() !== $theme && get_template() !== $theme ) { return false; } return array_key_exists( $theme, $GLOBALS['_paused_themes'] ); }
function is_theme_paused( $theme ) {
	if ( ! isset( $GLOBALS['_paused_themes'] ) ) {
		return false;
	}

	if ( get_stylesheet() !== $theme && get_template() !== $theme ) {
		return false;
	}

	return array_key_exists( $theme, $GLOBALS['_paused_themes'] );
}

常見問題

FAQs
檢視更多 >