Lazy loading not working in caption shortcodes
-
This site uses the Classic editor, and when the Image Caption is set, added media are embedded within a shortcode, like this:
[caption id="attachment_16740" align="aligncenter" width="1200"]<img class="wp-image-16740 size-full" src="https://www.behappyinlife.com/wp-content/uploads/2026/10/generations.jpg" alt="Family photos" width="1200" height="800" /> <a href="https://www.magnific.com/free-photo/people-looking-picture-album_29794256.htm#fromView=search&page=2&position=24&uuid=c63a0e89-b432-484c-9dc3-312d618a9eb9&track=ais_hybrid&query=old+family+photos">Image by magnific</a>[/caption]This then gets translated into:
<figure id="attachment_16740-4" aria-describedby="caption-attachment-16740-4" style="width: 1200px" class="wp-caption aligncenter"><img fetchpriority="high" decoding="async" class="wp-image-16740 size-full lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABLAAAAMgAQAAAAAbm6avAAAAAnRSTlMAAHaTzTgAAACMSURBVHja7cExAQAAAMKg9U9tB2+gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPgPX7wABGnGBnwAAAABJRU5ErkJggg==" alt="Family photos" width="1200" height="800" data-src="https://www.behappyinlife.com/wp-content/uploads/2026/10/generations.jpg" data-srcset="https://www.behappyinlife.com/wp-content/uploads/2026/10/generations.jpg 1200w, https://www.behappyinlife.com/wp-content/uploads/2026/10/generations-554x369.jpg 554w, https://www.behappyinlife.com/wp-content/uploads/2026/10/generations-750x500.jpg 750w, https://www.behappyinlife.com/wp-content/uploads/2026/10/generations-300x200.jpg 300w, https://www.behappyinlife.com/wp-content/uploads/2026/10/generations-360x240.jpg 360w" data-max-width="1200" data-sizes="auto" data-eio-rwidth="1200" data-eio-rheight="800" /><noscript><img fetchpriority="high" decoding="async" class="wp-image-16740 size-full" src="https://www.behappyinlife.com/wp-content/uploads/2026/10/generations.jpg" alt="Family photos" width="1200" height="800" srcset="https://www.behappyinlife.com/wp-content/uploads/2026/10/generations.jpg 1200w, https://www.behappyinlife.com/wp-content/uploads/2026/10/generations-554x369.jpg 554w, https://www.behappyinlife.com/wp-content/uploads/2026/10/generations-750x500.jpg 750w, https://www.behappyinlife.com/wp-content/uploads/2026/10/generations-300x200.jpg 300w, https://www.behappyinlife.com/wp-content/uploads/2026/10/generations-360x240.jpg 360w" sizes="(max-width: 1200px) 100vw, 1200px" data-eio="l" /></noscript><figcaption id="caption-attachment-16740-4" class="wp-caption-text"><a href="https://www.magnific.com/free-photo/people-looking-picture-album_29794256.htm#fromView=search&page=2&position=24&uuid=c63a0e89-b432-484c-9dc3-312d618a9eb9&track=ais_hybrid&query=old+family+photos" rel="noopener">Image by magnific</a></figcaption></figure>Lazy loading doesn’t work with this. Unless I add the
skip-lazyclass to the images, their inline placeholder isn’t replaced and nothing shows up on the page.This only happens to guest visitors, because of page optimisation & caching, but even when I exclude the EIO assets from page optimisation, images within captions don’t load.
To be clear, images without a caption render and behave correctly on MANY pages.
I’ve prepared a test page for this. Compare
- https://www.behappyinlife.com/test-page/ (no lazy loading)
- https://www.behappyinlife.com/test-page/?nocache (everything works)
Both the EIO scripts and the
figuretags look the same to me, so I’m at a complete loss here.The page I need help with: [log in to see the link]
You must be logged in to reply to this topic.