id summary reporter owner description type status priority milestone component version severity resolution keywords cc focuses 58089 Featured images within post content cause lazy-loading logic to apply incorrectly flixos90 flixos90 "When including featured images within post content, the logic to omit the `loading=""lazy""` attribute on the first x images may not be working correctly, depending on where the featured images are placed in the content. The reason for that is that each featured image calls `wp_get_loading_attr_default()` with a context of `the_post_thumbnail` ''while'' the post content is being parsed. In other words, `the_content` filter triggers the logic of adding lazy-loading attributes to the output using the the `the_content` context, but before that happens all blocks are parsed, including those that display featured images via `get_the_post_thumbnail()`. These calls then trigger the logic for featured images to apply ''within'' post content, but that logic is only intended to apply when featured images are displayed by themselves, i.e. outside of post content. I ran into this bug on my own website and was able to figure out a solution, but I haven't yet been able to replicate it on another site. That said, I am quite certain that it is a bug, but will need to investigate more closely to figure out how to replicate it with core. Potentially the only way to trigger it is using certain custom blocks. This bug was likely introduced by the original feature #53675, and is furthermore related to #56930, although the latter is likely not the cause for it." defect (bug) closed high 6.3 Media 5.9 normal fixed has-patch, has-unit-tests, has-dev-note performance