[wp-trac] [WordPress Trac] #50801: A filter for wp_get_attachment_image() html output

WordPress Trac noreply at wordpress.org
Tue Jul 28 20:26:58 UTC 2020


#50801: A filter for wp_get_attachment_image() html output
-------------------------+-----------------------------
 Reporter:  prionkor     |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Media        |    Version:  5.4.2
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 The function `wp_get_attachment_image()` is used to output image tags in
 WP sites. Currently it has a filter for attr but not filter on html output
 of the function. I am proposing a filter so plugin developers can modify
 its output.

 **An example use case:**

 Output of `<picture>` tag instead of `<img>` for supporting multiple
 format of images (jpeg, webp).

 {{{

 <picture>
    <source type="image/jpeg" src="foo.jpg" />
    <img src="foo.webp" alt="Bar" />
 </picture>

 }}}

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


More information about the wp-trac mailing list