I'm using the following attachment image sizes in my theme: "thumbnail" (320) "medium" (640), "medium_large" (768) and "large" (1280).
The default WordPress "srcset" and "sizes" attributes on the tags are causing the browser to download unnecessarily large images in large viewports. For example, some of my layouts display the images in a grid with multiple columns, so it's not necessary to load the largest version of the image in these cases.
Is there a way for me to specify the maximum image size that should be downloaded?
Specifically, I tried looking for a way to customize the "srcset" attribute to exclude anything larger than 768px, but can't seem to figure out how to do this.
Any advice is really appreciated.