I want to change the output for get_header_image_tag function to output the exact HTML that I want to. I also want to be able to add data to the output such as new srcset that have not been covered...
I have tried to use <a href="https://developer.wordpress.org/reference/hooks/get_header_image_tag/" rel="nofollow">apply_filters get_header_image_tag</a> to test it out but couldn't get it to work:
I am pretty convinced that my understanding of how the apply_filters works might be the issue there... I've been reading about it but I can't get my head around the parameters. Most of the examples I have found online used only a hook and a single value.
The way I understood it, I want the output to be
by using the data in
and replacing the URL attribute with 'test'.
However, what is being outputted is the default get_header_image_tag. I've also tried to directly echo the apply_filters:
But then, only
is outputted...
I have tried to use <a href="https://developer.wordpress.org/reference/hooks/get_header_image_tag/" rel="nofollow">apply_filters get_header_image_tag</a> to test it out but couldn't get it to work:
Code:
apply_filters('get_header_image_tag', "<img src>", get_custom_header(), ['url' => 'test']);
echo get_header_image_tag();
I am pretty convinced that my understanding of how the apply_filters works might be the issue there... I've been reading about it but I can't get my head around the parameters. Most of the examples I have found online used only a hook and a single value.
The way I understood it, I want the output to be
Code:
<img src=url>
Code:
get_custom_header()
However, what is being outputted is the default get_header_image_tag. I've also tried to directly echo the apply_filters:
Code:
echo apply_filters('get_header_image_tag', "<img src>", get_custom_header(), ['url' => 'test']);
But then, only
Code:
<img src>