[wp-trac] [WordPress Trac] #53675: Omit lazy-loading attribute on first content image/iframe

WordPress Trac noreply at wordpress.org
Thu May 18 19:53:52 UTC 2023


#53675: Omit lazy-loading attribute on first content image/iframe
-------------------------------------------------+-------------------------
 Reporter:  flixos90                             |       Owner:  flixos90
     Type:  enhancement                          |      Status:  closed
 Priority:  normal                               |   Milestone:  5.9
Component:  Media                                |     Version:  5.5
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests has-dev-    |     Focuses:
  note                                           |  performance
-------------------------------------------------+-------------------------

Comment (by flixos90):

 In [changeset:"55825" 55825]:
 {{{
 #!CommitTicketReference repository="" revision="55825"
 Media: Prevent special images within post content to skew image counts and
 cause lazy-loading bugs.

 In order to skip lazy-loading the first few images on a page, as of
 WordPress 5.9 there has been logic to count images that are eligible based
 on certain criteria. One of those groups are images that appear within the
 content of a post.

 This changeset fixes a bug where images created via
 `get_the_post_thumbnail()` or `wp_get_attachment_image()` that are
 injected into the post content would skew the count and therefore result
 in all images to be lazy-loaded, potentially hurting load time
 performance. This is relevant for example when those functions are called
 in server-side rendered blocks, or any other filter callbacks hooked into
 `the_content`.

 Props flixos90, antpb, joedolson, spacedmonkey, mukesh27, thekt12,
 costdev, jrf.
 Fixes #58089.
 See #53675.
 }}}

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


More information about the wp-trac mailing list