wp_theme_json_data_user
云策文档标注
概述
wp_theme_json_data_user 是一个 WordPress 过滤器,用于修改用户提供的全局样式和设置数据。它允许开发者在处理用户自定义配置时进行干预。
关键要点
- 这是一个过滤器钩子,用于过滤用户提供的全局样式和设置数据。
- 参数 $theme_json 是一个 WP_Theme_JSON_Data 类实例,用于访问和更新底层数据。
- 在 WP_Theme_JSON_Resolver::get_user_data() 方法中使用,返回用户的原始配置。
- 从 WordPress 6.1.0 版本开始引入。
代码示例
$theme_json = apply_filters( 'wp_theme_json_data_user', new WP_Theme_JSON_Data( $config, 'custom' ) );
原文内容
Filters the data provided by the user 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_user', new WP_Theme_JSON_Data( $config, 'custom' ) );
Changelog
| Version | Description |
|---|---|
| 6.1.0 | Introduced. |