site_allowed_themes
云策文档标注
概述
site_allowed_themes 是一个 WordPress 过滤器,用于修改站点允许使用的主题数组。它允许开发者基于站点 ID 动态控制可用的主题列表。
关键要点
- 过滤器名称:site_allowed_themes
- 参数:$allowed_themes(主题样式表名称数组)和 $blog_id(站点 ID,默认为当前站点)
- 用途:过滤站点允许的主题数组,常用于多站点环境或权限控制
- 相关函数:WP_Theme::get_allowed_on_site() 用于获取允许的主题列表
- 引入版本:WordPress 4.5.0
原文内容
Filters the array of themes allowed on the site.
Parameters
$allowed_themesstring[]-
An array of theme stylesheet names.
$blog_idint-
ID of the site. Defaults to current site.
Source
return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id );
Changelog
| Version | Description |
|---|---|
| 4.5.0 | Introduced. |