customize_load_themes
云策文档标注
概述
customize_load_themes 是一个 WordPress 过滤器,用于在自定义器中加载主题数据时进行过滤。它允许开发者从外部源加载主题数据,或修改来自 wp_prepare_themes_for_js() 或 themes_api() 的数据。
关键要点
- 过滤器名称:customize_load_themes
- 主要用途:过滤自定义器中加载的主题数据,支持外部数据源或数据修改
- 相关函数:wp_prepare_themes_for_js()、themes_api()
- 相关类:WP_Customize_Manager
- 引入版本:4.9.0
代码示例
$themes = apply_filters( 'customize_load_themes', $themes, $args, $this );注意事项
- 参数:$themes(数组或 stdClass 对象,主题数据)、$args(数组,查询参数如页面、搜索词、标签)、$manager(WP_Customize_Manager 实例)
- 使用场景:在 WP_Customize_Manager::handle_load_themes_request() 中调用,用于主题浏览/安装界面
原文内容
Filters the theme data loaded in the customizer.
Description
This allows theme data to be loading from an external source, or modification of data loaded from wp_prepare_themes_for_js() or WordPress.org via themes_api().
See also
Parameters
$themesarray|stdClass-
Nested array or object of theme data.
$argsarray-
List of arguments, such as page, search term, and tags to query for.
$managerWP_Customize_Manager-
Instance of Customize manager.
Source
$themes = apply_filters( 'customize_load_themes', $themes, $args, $this );
Changelog
| Version | Description |
|---|---|
| 4.9.0 | Introduced. |