Archived topic
Correct image thumbnail size not used on mobile and iPad: larger image resized
17 replies · Started by David on December 23, 2019
Have you tried setting the image sizes in Customize > Layout > Blog? Those options will resize the image you upload.
If you want to disable srcset on archives only, try this:
add_action( 'wp', function() {
if ( ! is_singular() ) {
add_filter( 'wp_calculate_image_srcset', '__return_false' );
}
} );
Hello Tom,
thank you very much.
The second snippet works.
I now consistently get small images on archive pages, and as far as I can see, srcset on individual posts.
I understand that for individual posts it needs to serve a size that can satisfy both vertical and horizontal display.
What still slightly confuses me is this:
When srcset is active, a specific size is specified, the image is available in that size, then still a larger image is being served and resized to the specified size.
If srcset works in this fashion, I think thumbnails/fixed-size images are best treated differently from normal post images.
I guess these large magazine sites don't use srcset to get the size down for all these preview images.
And many thanks also to David for looking into this.
Have a great day.
Glad it worked!
I'm not a huge fan of srcset, it's just something that WordPress implemented by default a couple of years ago. It makes sense for images in your content, but not so much for featured images (as we've found out here).