mirror of
git://develop.git.wordpress.org/
synced 2025-04-07 13:43:25 +02:00
Themes: Introduce get_header_image_tag_attributes
hook.
This change adds a filter inside of the `get_header_image_tag()` function allowing developers to filter the attributes of the header image HTML tag before they are escaped, concatenated, and returned. Before this change, it was not possible to externally and preemptively intercept this array of attributes. After this change, these attributes can now be easily filtered, matching it nicely to the `wp_get_attachment_image_attributes` hook. Props audrasjb, chaion07, junaidbhura, sabernhardt. Fixes #38942. git-svn-id: https://develop.svn.wordpress.org/trunk@51978 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
df8a2b408b
commit
e30e4b6f00
@ -1234,6 +1234,16 @@ function get_header_image_tag( $attr = array() ) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Filters the list of header image attributes.
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @param array $attr Array of the attributes for the image tag.
|
||||
* @param object $header The custom header object returned by 'get_custom_header()'.
|
||||
*/
|
||||
$attr = apply_filters( 'get_header_image_tag_attributes', $attr, $header );
|
||||
|
||||
$attr = array_map( 'esc_attr', $attr );
|
||||
$html = '<img';
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user