wp_get_duotone_filter_svg()
云策文档标注
概述
wp_get_duotone_filter_svg() 函数用于返回预设的双色调过滤器 SVG 字符串,但自 WordPress 6.3.0 起已弃用,建议改用 WP_Duotone::get_filter_svg_from_preset() 方法。
关键要点
- 函数功能:根据 theme.json 中的预设值生成双色调过滤器 SVG 字符串。
- 弃用状态:自 WordPress 6.3.0 起弃用,推荐使用 WP_Duotone::get_filter_svg_from_preset() 替代。
- 参数:$preset(必需),为 theme.json 中定义的双色调预设数组。
- 返回值:字符串类型的双色调 SVG 过滤器。
代码示例
function wp_get_duotone_filter_svg( $preset ) {
_deprecated_function( __FUNCTION__, '6.3.0', 'WP_Duotone::get_filter_svg_from_preset()' );
return WP_Duotone::get_filter_svg_from_preset( $preset );
}注意事项
- 此函数已弃用,新代码应避免使用,以保持兼容性和最佳实践。
- 相关函数:WP_Duotone::get_filter_svg_from_preset() 和 _deprecated_function()。
原文内容
Returns the duotone filter SVG string for the preset.
Parameters
$presetarrayrequired-
Duotone preset value as seen in theme.json.
Source
function wp_get_duotone_filter_svg( $preset ) {
_deprecated_function( __FUNCTION__, '6.3.0', 'WP_Duotone::get_filter_svg_from_preset()' );
return WP_Duotone::get_filter_svg_from_preset( $preset );
}
Changelog
| Version | Description |
|---|---|
| 6.3.0 | Deprecated. Use WP_Duotone::get_filter_svg_from_preset() instead. |
| 5.9.1 | Introduced. |