[wp-trac] [WordPress Trac] #58089: Featured images within post content cause lazy-loading logic to apply incorrectly

WordPress Trac noreply at wordpress.org
Thu Apr 27 21:11:28 UTC 2023


#58089: Featured images within post content cause lazy-loading logic to apply
incorrectly
----------------------------------------+--------------------------
 Reporter:  flixos90                    |       Owner:  flixos90
     Type:  defect (bug)                |      Status:  assigned
 Priority:  normal                      |   Milestone:  6.3
Component:  Media                       |     Version:  5.9
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |     Focuses:  performance
----------------------------------------+--------------------------
Changes (by flixos90):

 * keywords:  has-patch => has-patch needs-unit-tests
 * owner:  (none) => flixos90
 * status:  new => assigned


Comment:

 I have enhanced the PR to apply the same approach when the
 `wp_get_attachment_image()` function is called within `the_content`
 filter. This is commonly used today by e.g. blocks that may call the
 function or plugins that rely on the `the_content` filter to inject their
 own content.

 With the check here, it is ensured that such images are only counted once,
 as part of going through the entire post content (i.e. the "the_content"
 `$context`).

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


More information about the wp-trac mailing list