函数文档

wp_render_duotone_filter_preset()

💡 云策文档标注

概述

此函数用于渲染双色调滤镜的SVG并返回CSS filter属性以引用该SVG。自WordPress 5.9.1版本起已被弃用,建议使用wp_get_duotone_filter_property()替代。

关键要点

  • 函数wp_render_duotone_filter_preset()已弃用,自5.9.1版本起应改用wp_get_duotone_filter_property()。
  • 参数$preset为必需数组,表示theme.json中定义的双色调预设值。
  • 返回值为字符串类型的双色调CSS filter属性。

代码示例

function wp_render_duotone_filter_preset( $preset ) {
    _deprecated_function( __FUNCTION__, '5.9.1', 'wp_get_duotone_filter_property()' );

    return wp_get_duotone_filter_property( $preset );
}

注意事项

  • 此函数在5.9.0版本引入,5.9.1版本弃用,开发者需更新代码以避免使用弃用函数。
  • 相关函数包括wp_get_duotone_filter_property()和_deprecated_function(),用于替代和标记弃用。

📄 原文内容

Renders the duotone filter SVG and returns the CSS filter property to reference the rendered SVG.

Description

See also

Parameters

$presetarrayrequired
Duotone preset value as seen in theme.json.

Return

string Duotone CSS filter property.

Source

function wp_render_duotone_filter_preset( $preset ) {
	_deprecated_function( __FUNCTION__, '5.9.1', 'wp_get_duotone_filter_property()' );

	return wp_get_duotone_filter_property( $preset );
}

Changelog

Version Description
5.9.1 Deprecated. Use wp_get_duotone_filter_property() introduced in 5.9.1.
5.9.0 Introduced.