[wp-trac] [WordPress Trac] #44427: Introduce lazy-loading API for media and other elements

WordPress Trac noreply at wordpress.org
Fri Aug 3 13:22:53 UTC 2018


#44427: Introduce lazy-loading API for media and other elements
-----------------------------+------------------------------
 Reporter:  mor10            |       Owner:  (none)
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Media            |     Version:
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+------------------------------

Comment (by tabrisrp):

 Here is a list of functions we identified, which outputs HTML for images
 and have an available filter:
 - `get_avatar()`
 https://developer.wordpress.org/reference/functions/get_avatar/
 - `get_image_tag()`
 https://developer.wordpress.org/reference/functions/get_image_tag/
 - `get_the_post_thumbnail()` with `post_thumbnail_html` filter
 https://developer.wordpress.org/reference/functions/get_the_post_thumbnail/

 `get_the_post_thumbnail()` uses `wp_get_attachment_image()` under the
 hood, which doesn't have a filter for the whole HTML returned (see
 https://core.trac.wordpress.org/ticket/27399), only for the attributes
 with `wp_get_attachment_image_attributes`.

 In the case of images added into the main content and in widgets like the
 image widget, I suppose the best approach would be to add the attributes
 directly to the generated HTML at that time, the same way than for the
 responsive attributes.

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


More information about the wp-trac mailing list