get_header_image_tag_attributes
云策文档标注
概述
此文档介绍 WordPress 中的 get_header_image_tag_attributes 过滤器,用于修改自定义头部图像的 HTML 属性数组。开发者可以通过此 Hook 调整图像标签的属性,如 src、alt 等。
关键要点
- 过滤器名称:get_header_image_tag_attributes
- 参数:$attr(属性数组)和 $header(自定义头部对象)
- 用途:在生成头部图像标签时,过滤其属性数组
- 相关函数:get_header_image_tag()
- 引入版本:WordPress 5.9.0
代码示例
$attr = apply_filters( 'get_header_image_tag_attributes', $attr, $header );
原文内容
Filters the list of header image attributes.
Parameters
$attrarray-
Array of the attributes for the image tag.
$headerobject-
The custom header object returned by ‘get_custom_header() ‘.
Source
$attr = apply_filters( 'get_header_image_tag_attributes', $attr, $header );
Changelog
| Version | Description |
|---|---|
| 5.9.0 | Introduced. |