Is responsive-images.php still relevant?
I'm trying to wrap my head around if the three filters added in responsive-images.php is needed. Or where they added at a time when WordPress core didn't support responsive images and are just "technical debts" now?
For me they seems to cause more issues than they solve (like most stuff in cleanup.php that I stopped using long ago), but then again I'm no master at responsive images.
@Aetles I'm not sure how necessary it is, but I found the following which might explain why we have it in FP:
While WordPress does an exceptional job at inserting all available sizes into the srcset attribute, the sizes attribute is slightly more difficult to predict. This is because the sizes attribute is responsible for telling the browser how wide the image will be at every available viewport. Since that information will be different depending on the styling of the user’s theme, the best we can do is provide the following reasonable default:
sizes="(max-width: {{image-width}}) 100vw, {{image-width}}"
This default sizes attribute accomplishes two things. First, it ensures that a valid sizes attribute exists on the image, which recently became a mandatory requirement according to the specification. Second, it ensures that the browser doesn’t provide an image source that is larger than the original width requested. If there is any CSS manipulating the size of the image at different viewport widths, however, this default sizes attribute becomes less helpfull.
Since the default sizes attribute will only help with images that are not altered by CSS, filter hooks have been provided to allow theme developers to adjust the sizes attribute of every image, ensuring that a perfect sizes attribute can be delivered at every breakpoint.
Source: https://www.smashingmagazine.com/2015/12/responsive-images-in-wordpress-core/
Ah, great digging.
I had some weird issues with the wrong (low res) image being loaded instead of the appropriate one and removing these filters solved it. I never looked into what the issue really was (and I don't have deep knowledge of responsive images in WP to begin with).
(Generally speaking I'm trying to have as few filters as possible that modifies WP behaviour or "clean things up" since those tend to become irrelevant or even causing issues as WP develops over time. Have good documentation in code about why they were added and/or what issue they solve helps a lot.)