get_allowed_themes

函式
get_allowed_themes ( No parameters )
返回值
  • (WP_Theme[]) Array of WP_Theme objects keyed by their name.
相關
  • wp_get_themes()
定義位置
相關方法
get_site_allowed_themeswpmu_get_blog_allowedthemesget_allowed_mime_typesget_broken_themesget_allowed_block_types
引入
3.0.0
棄用
3.4.0

get_allowed_themes: 此函式返回一個允許在網站上使用的主題陣列。

獲取當前網站允許的主題。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function get_allowed_themes() {
_deprecated_function( __FUNCTION__, '3.4.0', "wp_get_themes( array( 'allowed' => true ) )" );
$themes = wp_get_themes( array( 'allowed' => true ) );
$wp_themes = array();
foreach ( $themes as $theme ) {
$wp_themes[ $theme->get('Name') ] = $theme;
}
return $wp_themes;
}
function get_allowed_themes() { _deprecated_function( __FUNCTION__, '3.4.0', "wp_get_themes( array( 'allowed' => true ) )" ); $themes = wp_get_themes( array( 'allowed' => true ) ); $wp_themes = array(); foreach ( $themes as $theme ) { $wp_themes[ $theme->get('Name') ] = $theme; } return $wp_themes; }
function get_allowed_themes() {
	_deprecated_function( __FUNCTION__, '3.4.0', "wp_get_themes( array( 'allowed' => true ) )" );

	$themes = wp_get_themes( array( 'allowed' => true ) );

	$wp_themes = array();
	foreach ( $themes as $theme ) {
		$wp_themes[ $theme->get('Name') ] = $theme;
	}

	return $wp_themes;
}

常見問題

FAQs
檢視更多 >