wp_skip_paused_themes

函式
wp_skip_paused_themes ( $themes )
引數
  • (string[]) $themes Array of absolute theme directory paths.
    Required:
返回值
  • (string[]) Filtered array of absolute paths to themes, without any paused themes.
定義位置
相關方法
wp_paused_themeswp_skip_paused_pluginswp_using_themeswp_get_themeswp_update_themes
引入
5.2.0
棄用
-

wp_skip_paused_themes: 這個函式用來檢查在處理一個WordPress動作或過濾器時是否應該跳過暫停的主題。如果這個函式返回true,暫停的主題將被跳過。

過濾一個給定的主題列表,從其中刪除任何暫停的主題。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_skip_paused_themes( array $themes ) {
$paused_themes = wp_paused_themes()->get_all();
if ( empty( $paused_themes ) ) {
return $themes;
}
foreach ( $themes as $index => $theme ) {
$theme = basename( $theme );
if ( array_key_exists( $theme, $paused_themes ) ) {
unset( $themes[ $index ] );
// Store list of paused themes for displaying an admin notice.
$GLOBALS['_paused_themes'][ $theme ] = $paused_themes[ $theme ];
}
}
return $themes;
}
function wp_skip_paused_themes( array $themes ) { $paused_themes = wp_paused_themes()->get_all(); if ( empty( $paused_themes ) ) { return $themes; } foreach ( $themes as $index => $theme ) { $theme = basename( $theme ); if ( array_key_exists( $theme, $paused_themes ) ) { unset( $themes[ $index ] ); // Store list of paused themes for displaying an admin notice. $GLOBALS['_paused_themes'][ $theme ] = $paused_themes[ $theme ]; } } return $themes; }
function wp_skip_paused_themes( array $themes ) {
	$paused_themes = wp_paused_themes()->get_all();

	if ( empty( $paused_themes ) ) {
		return $themes;
	}

	foreach ( $themes as $index => $theme ) {
		$theme = basename( $theme );

		if ( array_key_exists( $theme, $paused_themes ) ) {
			unset( $themes[ $index ] );

			// Store list of paused themes for displaying an admin notice.
			$GLOBALS['_paused_themes'][ $theme ] = $paused_themes[ $theme ];
		}
	}

	return $themes;
}

常見問題

FAQs
檢視更多 >