Filter hook 'get_header_image_tag_attributes'

in WP Core File wp-includes/theme.php at line 1340

View Source

get_header_image_tag_attributes

Filter Hook
Description
Filters the list of header image attributes.

Hook Information

File Location wp-includes/theme.php View on GitHub
Hook Type Filter
Line Number 1340

Hook Parameters

Type Name Description
array $attr Array of the attributes for the image tag.
object $header The custom header object returned by 'get_custom_header()'.

Usage Examples

Basic Usage
<?php
// Hook into get_header_image_tag_attributes
add_filter('get_header_image_tag_attributes', 'my_custom_filter', 10, 2);

function my_custom_filter($attr, $header) {
    // Your custom filtering logic here
    return $attr;
}

Source Code Context

wp-includes/theme.php:1340 - How this hook is used in WordPress core
<?php
1335  	 * @since 5.9.0
1336  	 *
1337  	 * @param array  $attr   Array of the attributes for the image tag.
1338  	 * @param object $header The custom header object returned by 'get_custom_header()'.
1339  	 */
1340  	$attr = apply_filters( 'get_header_image_tag_attributes', $attr, $header );
1341  
1342  	$attr = array_map( 'esc_attr', $attr );
1343  	$html = '<img';
1344  
1345  	foreach ( $attr as $name => $value ) {

PHP Documentation

<?php
/**
	 * 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()'.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/theme.php
Related Hooks

Related hooks will be displayed here in future updates.