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. Built from https://develop.svn.wordpress.org/trunk@51978 git-svn-id: http://core.svn.wordpress.org/trunk@51567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f60dae0731
commit
f5991aed63
|
@ -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';
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.9-alpha-51977';
|
||||
$wp_version = '5.9-alpha-51978';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue