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

WordPress Trac noreply at wordpress.org
Sun Nov 3 18:59:20 UTC 2019


#44427: Introduce lazy-loading API for media and other elements
----------------------------------------+--------------------------
 Reporter:  mor10                       |       Owner:  flixos90
     Type:  feature request             |      Status:  assigned
 Priority:  normal                      |   Milestone:  5.4
Component:  Media                       |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  needs-unit-tests has-patch  |     Focuses:  performance
----------------------------------------+--------------------------
Changes (by flixos90):

 * owner:  (none) => flixos90
 * status:  new => assigned
 * milestone:  Awaiting Review => 5.4


Comment:

 [attachment:"44427.3.diff"] expands on the previous patches:

 * It also lazy-loads iframes with the `loading` attribute, in addition to
 images.
 * It relies on a filter `wp_lazy_load_content_media` instead of theme
 support, since lazy-loading is not really a theme-related feature, based
 on conversations at WCUS contributor day.
 * It lazy-loads media by default. The filter can be used to opt-out for
 specific instances, or also globally in edge cases where that would be
 needed.
 * It simplifies the code a bit, using `preg_replace_callback()` instead of
 a foreach loop with individual replacements.

 cc @spacedmonkey @adamsilverstein

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


More information about the wp-trac mailing list