[wp-trac] [WordPress Trac] #54192: `get_header_image_tag` doesn't add `srcset`/`sizes`

WordPress Trac noreply at wordpress.org
Tue Sep 28 00:04:05 UTC 2021


#54192: `get_header_image_tag` doesn't add `srcset`/`sizes`
--------------------------+------------------------------
 Reporter:  strarsis      |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by strarsis):

 Replying to [comment:3 joyously]:
 > Let me amend my statement. For post content, the `srcset` and `sizes`
 are added later, by `wp_filter_content_tags()`.
 > The `get_header_image_tag()` function adds the attributes itself, just
 below where you referenced. Does your test case meet the condition?
 > `if ( empty( $attr['srcset'] ) && ! empty( $header->attachment_id ) ) `

 Good point. The test case would meet the condition, as `$attr` doesn't
 contain `srcset` and by default `srcset` is not added to `$attr`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54192#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list