[wp-trac] [WordPress Trac] #46134: Allow filtering of `$header` object in `get_header_image_tag()` function (for custom header image override)

WordPress Trac noreply at wordpress.org
Tue Jan 29 14:38:10 UTC 2019


#46134: Allow filtering of `$header` object in `get_header_image_tag()` function
(for custom header image override)
--------------------------+-----------------------------
 Reporter:  webmandesign  |      Owner:  (none)
     Type:  enhancement   |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  5.0.3
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Currently, when trying to override custom header image, it is only
 possible to filter header image URL (via `theme_mod_header_image`
 [https://developer.wordpress.org/reference/hooks/theme_mod_name/ filter
 hook]) or the actual image
 [https://developer.wordpress.org/reference/hooks/get_header_image_tag/
 output HTML] in
 [https://developer.wordpress.org/reference/functions/get_header_image_tag/
 get_header_image_tag()] function.

 It would be beneficial to allow filtering also the `$header` object of
 `get_header_image_tag()` function: in case of override via theme code we
 can set not only an image URL, but an image attachment ID too. That way
 the `get_header_image_tag()` function can do better job with image
 overrides (such as setting correct image `srcset` and `sizes` attributes
 and also [https://core.trac.wordpress.org/ticket/46124 the image alt
 text]).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46134>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list