wpmu_get_blog_allowedthemes()
云策文档标注
概述
wpmu_get_blog_allowedthemes() 是一个已弃用的 WordPress 函数,用于获取特定站点允许的主题列表。自 WordPress 3.4.0 起,建议使用 WP_Theme::get_allowed_on_site() 替代。
关键要点
- 函数 wpmu_get_blog_allowedthemes() 已弃用,自 WordPress 3.4.0 版本起不再推荐使用。
- 替代函数为 WP_Theme::get_allowed_on_site(),用于返回站点允许的主题样式表名称数组。
- 函数内部调用 _deprecated_function() 来标记弃用状态,并在使用时发出通知。
代码示例
function wpmu_get_blog_allowedthemes( $blog_id = 0 ) {
_deprecated_function( __FUNCTION__, '3.4.0', 'WP_Theme::get_allowed_on_site()' );
return array_map( 'intval', WP_Theme::get_allowed_on_site( $blog_id ) );
}注意事项
- 使用此函数可能导致弃用警告,建议更新代码以使用 WP_Theme::get_allowed_on_site()。
- 函数参数 $blog_id 默认为 0,表示当前站点,但实际功能已由替代函数处理。
原文内容
Deprecated functionality for getting themes allowed on a specific site.
Description
See also
Source
function wpmu_get_blog_allowedthemes( $blog_id = 0 ) {
_deprecated_function( __FUNCTION__, '3.4.0', 'WP_Theme::get_allowed_on_site()' );
return array_map( 'intval', WP_Theme::get_allowed_on_site( $blog_id ) );
}
Changelog
| Version | Description |
|---|---|
| 3.4.0 | Introduced. |