wp_theme_json_data_blocks
云策文档标注
概述
wp_theme_json_data_blocks 是一个 WordPress 过滤器钩子,用于过滤块提供的全局样式和设置数据。它允许开发者在 WP_Theme_JSON_Data 类实例化时修改块数据。
关键要点
- 这是一个过滤器钩子,用于处理块相关的全局样式和设置数据。
- 参数 $theme_json 是 WP_Theme_JSON_Data 类的实例,用于访问和更新底层数据。
- 在 WP_Theme_JSON_Resolver::get_block_data() 方法中使用,从 block.json 文件获取块样式。
- 自 WordPress 6.1.0 版本引入。
代码示例
$theme_json = apply_filters( 'wp_theme_json_data_blocks', new WP_Theme_JSON_Data( $config, 'blocks' ) );
原文内容
Filters the data provided by the blocks for global styles & settings.
Parameters
$theme_jsonWP_Theme_JSON_Data-
Class to access and update the underlying data.
Source
$theme_json = apply_filters( 'wp_theme_json_data_blocks', new WP_Theme_JSON_Data( $config, 'blocks' ) );
Changelog
| Version | Description |
|---|---|
| 6.1.0 | Introduced. |