Empty srcset after apply filter
-
I have a function which to apply a3 lazy load filter to my images (ACF):
function attach_image($id, $size = 'full', $icon = false, $attr = '') { $content = wp_get_attachment_image($id, $size, $icon, $attr); if( has_filter( 'a3_lazy_load_images' ) ) { return apply_filters('a3_lazy_load_images', $content, null ); } return $content; }
But when I use the function I get an image without srcset like that:
<img width="400" height="400" src="//chefranov.name/wp-content/plugins/a3-lazy-load/assets/images/lazy_placeholder.gif" data-lazy-type="image" data-src="https://chefranov.name/wp-content/uploads/2020/04/me-400x400.jpg" class="lazy lazy-hidden attachment-review-photo size-review-photo" alt="Евгений Чефранов" srcset="" data-srcset="https://chefranov.name/wp-content/uploads/2020/04/me-400x400.jpg 400w, https://chefranov.name/wp-content/uploads/2020/04/me-300x300.jpg 300w, https://chefranov.name/wp-content/uploads/2020/04/me-1024x1024.jpg 1024w, https://chefranov.name/wp-content/uploads/2020/04/me-150x150.jpg 150w, https://chefranov.name/wp-content/uploads/2020/04/me-768x768.jpg 768w, https://chefranov.name/wp-content/uploads/2020/04/me-1536x1536.jpg 1536w, https://chefranov.name/wp-content/uploads/2020/04/me-2048x2048.jpg 2048w, https://chefranov.name/wp-content/uploads/2020/04/me-50x50.jpg 50w" sizes="(max-width: 400px) 100vw, 400px" /><noscript><img width="400" height="400" src="https://chefranov.name/wp-content/uploads/2020/04/me-400x400.jpg" class="attachment-review-photo size-review-photo" alt="Евгений Чефранов" srcset="https://chefranov.name/wp-content/uploads/2020/04/me-400x400.jpg 400w, https://chefranov.name/wp-content/uploads/2020/04/me-300x300.jpg 300w, https://chefranov.name/wp-content/uploads/2020/04/me-1024x1024.jpg 1024w, https://chefranov.name/wp-content/uploads/2020/04/me-150x150.jpg 150w, https://chefranov.name/wp-content/uploads/2020/04/me-768x768.jpg 768w, https://chefranov.name/wp-content/uploads/2020/04/me-1536x1536.jpg 1536w, https://chefranov.name/wp-content/uploads/2020/04/me-2048x2048.jpg 2048w, https://chefranov.name/wp-content/uploads/2020/04/me-50x50.jpg 50w" sizes="(max-width: 400px) 100vw, 400px" />
And my page is not valid on W3C Validator. How can I fix it?The page I need help with: [log in to see the link]
- The topic ‘Empty srcset after apply filter’ is closed to new replies.