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
查看更多 >