network_allowed_themes
云策文档标注
概述
network_allowed_themes 是一个 WordPress 过滤器,用于过滤网络中允许的主题数组。它提供站点 ID 作为上下文,以便进一步定制允许的主题列表。
关键要点
- 这是一个过滤器钩子,允许开发者修改网络中允许的主题数组。
- 参数包括 $allowed_themes(主题样式表名称数组)和 $blog_id(站点 ID)。
- 常用于 WP_Theme::get_allowed() 方法中,以获取站点或网络允许的主题列表。
- 从 WordPress 4.5.0 版本开始引入。
代码示例
$network = (array) apply_filters( 'network_allowed_themes', self::get_allowed_on_network(), $blog_id );
原文内容
Filters the array of themes allowed on the network.
Description
Site is provided as context so that a list of network allowed themes can be filtered further.
Parameters
$allowed_themesstring[]-
An array of theme stylesheet names.
$blog_idint-
ID of the site.
Source
$network = (array) apply_filters( 'network_allowed_themes', self::get_allowed_on_network(), $blog_id );
Changelog
| Version | Description |
|---|---|
| 4.5.0 | Introduced. |