{"id":19044760,"date":"2026-10-14T12:17:42","date_gmt":"2026-10-14T12:17:42","guid":{"rendered":"https:\/\/wordpress.org\/support\/?post_type=topic&#038;p=19044760"},"modified":"2026-10-14T12:33:14","modified_gmt":"2026-10-14T12:33:14","slug":"lazy-loading-not-working-in-caption-shortcodes","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/lazy-loading-not-working-in-caption-shortcodes\/","title":{"rendered":"Lazy loading not working in caption shortcodes"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This site uses the Classic editor, and when the Image Caption is set, added media are embedded within a shortcode, like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;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\" \/&gt; &lt;a href=\"https:\/\/www.magnific.com\/free-photo\/people-looking-picture-album_29794256.htm#fromView=search&amp;amp;page=2&amp;amp;position=24&amp;amp;uuid=c63a0e89-b432-484c-9dc3-312d618a9eb9&amp;amp;track=ais_hybrid&amp;amp;query=old+family+photos\"&gt;Image by magnific&lt;\/a&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This then gets translated into:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;figure id=\"attachment_16740-4\" aria-describedby=\"caption-attachment-16740-4\" style=\"width: 1200px\" class=\"wp-caption aligncenter\"&gt;&lt;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\" \/&gt;&lt;noscript&gt;&lt;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\" \/&gt;&lt;\/noscript&gt;&lt;figcaption id=\"caption-attachment-16740-4\" class=\"wp-caption-text\"&gt;&lt;a href=\"https:\/\/www.magnific.com\/free-photo\/people-looking-picture-album_29794256.htm#fromView=search&amp;amp;page=2&amp;amp;position=24&amp;amp;uuid=c63a0e89-b432-484c-9dc3-312d618a9eb9&amp;amp;track=ais_hybrid&amp;amp;query=old+family+photos\" rel=\"noopener\"&gt;Image by magnific&lt;\/a&gt;&lt;\/figcaption&gt;&lt;\/figure&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Lazy loading doesn&#8217;t work with this. Unless I add the <code>skip-lazy<\/code> class to the images, their inline placeholder isn&#8217;t replaced and nothing shows up on the page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This only happens to guest visitors, because of page optimisation &amp; caching, but even when I exclude the EIO assets from page optimisation, images within captions don&#8217;t load.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To be clear, images without a caption render and behave correctly on MANY pages.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I&#8217;ve prepared a test page for this. Compare<\/p>\n\n\n\n<ul>\n<li><a href=\"https:\/\/www.behappyinlife.com\/test-page\" rel=\"nofollow\">https:\/\/www.behappyinlife.com\/test-page\/<\/a> (no lazy loading)<\/li>\n\n\n\n<li><a href=\"https:\/\/www.behappyinlife.com\/test-page\/?nocache\" rel=\"nofollow\">https:\/\/www.behappyinlife.com\/test-page\/?nocache<\/a> (everything works)<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Both the EIO scripts and the <code>figure<\/code> tags look the same to me, so I&#8217;m at a complete loss here.<\/p>\n","protected":false},"template":"","class_list":["post-19044760","topic","type-topic","status-publish","hentry","topic-tag-compatibility"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19044760","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19044760\/revisions"}],"predecessor-version":[{"id":19044796,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19044760\/revisions\/19044796"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=19044760"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}