Title: Missing srcset attribute inside
Last modified: September 26, 2024

---

# Missing srcset attribute inside

 *  Resolved [stefanoste](https://wordpress.org/support/users/stefanoste/)
 * (@stefanoste)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/missing-srcset-attribute-inside/)
 * The plugin generates the elements <picture> containing <source>
   inside <source
   > there should be a srcset attribute but it’s missing, this violates the HML5
   specs:[https://html.spec.whatwg.org/multipage/embedded-content.html#the-source-element](https://html.spec.whatwg.org/multipage/embedded-content.html#the-source-element)
 * checked with the HTML5 validator:
   [https://validator.w3.org/](https://validator.w3.org/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/missing-srcset-attribute-inside/#post-18039102)
 * Is this happening for all the images? I run the image generating HTML through
   the inbuilt WordPress filters that automatically add the srcset similar to other
   ones.
 * Can you show me please point me to where I can see the output on your site?
 * See code: [https://github.com/WebberZone/contextual-related-posts/blob/3.5.4/includes/frontend/class-media-handler.php#L302C27-L302C63](https://github.com/WebberZone/contextual-related-posts/blob/3.5.4/includes/frontend/class-media-handler.php#L302C27-L302C63)
 * It won’t work if there is no attachment ID, i.e. it’s not in the media library
   as it won’t know what images are available (at least that’s how I read it).
 *  Thread Starter [stefanoste](https://wordpress.org/support/users/stefanoste/)
 * (@stefanoste)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/missing-srcset-attribute-inside/#post-18040088)
 * yes, it’s happening for all the images, they are the normal featured images of
   the posts, you can see it happening everywhere:
   [https://recensioni-migliori.com/materassi/classifiche/confronto-2022/](https://recensioni-migliori.com/materassi/classifiche/confronto-2022/)
 * ie:
 *     ```wp-block-code
       <picture>	<source sizes='(max-width: 300px) 100vw, 300px'			type="image/webp"			data-srcset="https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600-300x113.png.webp 300w, https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600.png.webp 600w">		<img style="max-width:300px;max-height:113px;"			 src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAABxAQAAAABHYaNFAAAAAnRSTlMAAHaTzTgAAAAbSURBVFjD7cGBAAAAAMOg+VNf4AhVAQAAAHAMETcAAYNa3Q8AAAAASUVORK5CYII="			 class="crp_featured crp_thumb medium lazyload"			 alt="Materassi e Doghe Pale Special"			 title="Materassi e Doghe Pale Special"			 data-eio="p"			 data-src="https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600-300x113.png"			 decoding="async"			 data-srcset="https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600-300x113.png 300w, https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600.png 600w"			 data-sizes="auto"			 width="300"			 height="113"			 data-eio-rwidth="300"			 data-eio-rheight="113"/>	</picture>
       ```
   
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/missing-srcset-attribute-inside/#post-18040303)
 * [@stefanoste](https://wordpress.org/support/users/stefanoste/)
 * I just checked your site URL and don’t see a picture>source. But a figure>img
   which is how I generate the code within CRP. See the code I have and the browser
   screenshot.
 *     ```wp-block-code
       <figure>    <img        style="max-width: 300px; max-height: 113px;"        src="https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600-300x113.png.webp"        class="crp_featured crp_thumb medium lazyautosizes lazyloaded"        alt="Materassi e Doghe Pale Special"        title="Materassi e Doghe Pale Special"        data-src="https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600-300x113.png.webp"        decoding="async"        data-srcset="https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600-300x113.png.webp 300w, https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600.png.webp 600w"        data-sizes="auto"        width="300"        height="113"        data-eio-rwidth="300"        data-eio-rheight="113"        sizes="300px"        srcset="https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600-300x113.png.webp 300w, https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600.png.webp 600w"    />    <noscript>        <img            style="max-width: 300px; max-height: 113px;"            src="https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600-300x113.png.webp"            class="crp_featured crp_thumb medium"            alt="Materassi e Doghe Pale Special"            title="Materassi e Doghe Pale Special"            srcset="https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600-300x113.png.webp 300w, https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600.png.webp 600w"            sizes="(max-width: 300px) 100vw, 300px"            data-eio="l"        />    </noscript></figure>
       ```
   
 * See the screenshot: [https://ibb.co/ySCkdms](https://ibb.co/ySCkdms)
 * Wondering if this is being “converted” or rendered differently in another browser?
   I’m on Firefox for Mac. But also checked it in Brave which is built on Chromium.
 *  Thread Starter [stefanoste](https://wordpress.org/support/users/stefanoste/)
 * (@stefanoste)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/missing-srcset-attribute-inside/#post-18040334)
 * [@ajay](https://wordpress.org/support/users/ajay/) thank you for the check, there
   must surely be another cause

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Missing srcset attribute inside’ is closed to new replies.

 * ![](https://ps.w.org/contextual-related-posts/assets/icon-256x256.png?rev=2985705)
 * [Contextual Related Posts](https://wordpress.org/plugins/contextual-related-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contextual-related-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contextual-related-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/contextual-related-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contextual-related-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contextual-related-posts/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [stefanoste](https://wordpress.org/support/users/stefanoste/)
 * Last activity: [1 year, 8 months ago](https://wordpress.org/support/topic/missing-srcset-attribute-inside/#post-18040334)
 * Status: resolved