wp_register_duotone_support()
云策文档标注
概述
wp_register_duotone_support() 函数用于为支持双色调的区块类型注册样式和颜色属性。该函数已在 WordPress 6.3.0 版本中被弃用,建议使用 WP_Duotone::register_duotone_support() 替代。
关键要点
- 函数功能:注册区块的双色调支持属性,包括样式和颜色。
- 参数:接受一个 $block_type 参数,类型为 WP_Block_Type,用于指定区块类型。
- 弃用状态:自 WordPress 6.3.0 起被弃用,应改用 WP_Duotone::register_duotone_support() 方法。
- 历史版本:在 WordPress 5.8.0 中引入,6.3.0 中弃用。
代码示例
function wp_register_duotone_support( $block_type ) {
_deprecated_function( __FUNCTION__, '6.3.0', 'WP_Duotone::register_duotone_support()' );
return WP_Duotone::register_duotone_support( $block_type );
}注意事项
- 使用此函数会触发 _deprecated_function() 警告,提示开发者迁移到新方法。
- 相关函数:WP_Duotone::register_duotone_support() 是替代实现,位于 wp-includes/class-wp-duotone.php。
原文内容
Registers the style and colors block attributes for block types that support it.
Parameters
$block_typeWP_Block_Typerequired-
Block Type.
Source
function wp_register_duotone_support( $block_type ) {
_deprecated_function( __FUNCTION__, '6.3.0', 'WP_Duotone::register_duotone_support()' );
return WP_Duotone::register_duotone_support( $block_type );
}
Changelog
| Version | Description |
|---|---|
| 6.3.0 | Deprecated. Use WP_Duotone::register_duotone_support() instead. |
| 5.8.0 | Introduced. |