Title: Changing the Header Image tag (adding attribute)
Last modified: January 24, 2021

---

# Changing the Header Image tag (adding attribute)

 *  [mattspace](https://wordpress.org/support/users/mattspace/)
 * (@mattspace)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/changing-the-header-image-tag-adding-attribute/)
 * Hi,
 * I would like to add an attribute to the image tag for the header image that loads
   up on the splash page in my 2017 themed sites.
 *     ```
       <div id="wp-custom-header" class="wp-custom-header">
          <img src="_the-image-url_" width="2000" height="1200" alt="_the-image-alt_"/>
        </div>
       ```
   
 * I’m trying to diagnose an issue where on iPad header images just give up rendering/
   downloading about 2/3 of the way through, and won’t show up correctly unless 
   ypu manually open the image directly in a different tab, then reload the page
   and it’ll work.
 * I found a suggestion to try:
 *     ```
       <img decoding="sync" src="@Url" />
       ```
   
 * So, given I’m working on a child theme, I’m assuming I have to do something in
   my functions.php to override the default function that generates that image tag,
   so as to add the decoding=”sync” attribute into it. I just can’t find the appropriate
   bit in the 2017 theme files.
 * Anyhelp would be appreciated, thanks.
 * BTW: while I might be able to solve this with a CSS media query, and creating
   a new stylesheet for iPad, I really want to try fixing it this way, just to see
   if it works. Thanks.
    -  This topic was modified 5 years, 4 months ago by [mattspace](https://wordpress.org/support/users/mattspace/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Ian Sackofwits](https://wordpress.org/support/users/plantprogrammer/)
 * (@plantprogrammer)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/changing-the-header-image-tag-adding-attribute/#post-13952739)
 * Hi, mattspace, the following code template may help you in adding additional 
   image attributes to your header image:
 *     ```
       add_filter("get_header_image_tag", "change_header_image_tag", 10, 3);
   
       function change_header_image_tag( $html, $header, $attr )
       {
       	// TODO
       	return $html;
       }
       ```
   
 * Here is a link to a developer page that describes the filter that’s being used:
   [https://developer.wordpress.org/reference/hooks/get_header_image_tag/](https://developer.wordpress.org/reference/hooks/get_header_image_tag/)
 *  Thread Starter [mattspace](https://wordpress.org/support/users/mattspace/)
 * (@mattspace)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/changing-the-header-image-tag-adding-attribute/#post-13952963)
 * Hi Ian,
 * Would you mind explaining a bit more – I’ve found myself unable to make much 
   head or tail of wordpress since ~2012 when the PHP was in the HTML structure,
   so you could easily understand the black box from looking at inputs and outputs,
   without any real JS/PHP knowledge.
 * Do I add that code into my functions.php file? What part adds the decoding=”sync”
   attribute / value to the Image tag?
 * thanks,

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Changing the Header Image tag (adding attribute)’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/twentyseventeen/4.1/screenshot.
   png)
 * Twenty Seventeen
 * [Support Threads](https://wordpress.org/support/theme/twentyseventeen/)
 * [Active Topics](https://wordpress.org/support/theme/twentyseventeen/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/twentyseventeen/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/twentyseventeen/reviews/)

## Tags

 * [image](https://wordpress.org/support/topic-tag/image/)
 * [ios](https://wordpress.org/support/topic-tag/ios/)

 * 2 replies
 * 2 participants
 * Last reply from: [mattspace](https://wordpress.org/support/users/mattspace/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/changing-the-header-image-tag-adding-attribute/#post-13952963)
 * Status: not resolved