To show a srcset, there must be multiple image sizes of the same aspect ratio. When you set your thumbnail to hard crop without creating any other image sizes you are ensuring that there won’t be a srcset.
You might find my answer here helpful.
Briefly, in your case, adding this line:
add_image_size ( 'double-size', 1270, 400, true );
… will make a srcset with both the cropped sizes when you upload a fresh image larger than 1270×400.
Related Posts:
- Is there a hook which fires after all thumbnails are generated?
- get_the_post_thumbnail_url with an unregistered size
- Cropped featured image replaces original image in gallery
- Removing Title Tag from Thumbnails
- Disable wordpress image sizes generation
- Lazyload post thumbnails
- How to stop thumbnail generation from some images and different size thumbnail generate
- Update old Post image metadata to ‘thumbnail’ wp_attached_file
- How to stop wordpress always displaying full-res images
- Fixing image names for a site being restored
- Filter for post_thumbnail: link to small src and add data-attribute [duplicate]
- Can we use featured image as third party website image URL
- add_image_size not working
- Product Images Low Quality After Updating From WP 3.5 to 4 [closed]
- adding image to post thumbnail from another server
- How to add thumbnails to posts and pages automatically in a uniformed fixed elegant way?
- How to use default image as featured image by implement some code in function.php
- WordPress Multisite: Images moved to /sites/1?
- I cannot upload images to post or the media library in wordpress
- Why image Thumbnail url is not displaying with custom size?
- Making a thumbnail if there exist a link with. jpg or .png extension in WordPress
- WP is showing wrong image dimensions
- set_post_thumbnail_size vs add_image_size
- How to automatically add rounded corners to thumbnails?
- New image size version only for the Featured Image file
- Remove title attribute from images
- Insert an image into a post by API
- How to limit number of images being printer out in “Set Featured Image” pop up?
- Black and White thumbnails
- Double thumbnails?
- Displaying a featured image (only img url) as the img src?
- When displaying the featured image, is has_post_thumbnail() necessary?
- Changing playlist shortcode thumbnail sizes?
- How to make programmatic image upload generate thumbnail and sizes?
- Get original image from thumbnail URL
- Cannot get full thumbnail size using the_post_thumbnail
- Save image as featured image
- Display latest 12 images from media library
- Thumbnails produce unwanted gray pixels on white background [closed]
- attach unattached featured images to respective posts
- WordPress reduces the full size image and uses it as the original
- Remove image classes from post thumbnail output
- Show full image thumbnail
- Special purpose photos with each post
- Get thumbnail url of custom meta image?
- SVG Featured image not shown in twitter
- Print specific image size in galley loop
- WordPress crops images differently on retina screens?
- Image thumbnails not available post migration, but still accessible via direct URL – DB issue
- Upload media files to Amazon S3
- How can I add a “data-pin-nopin” the featured image html?
- how to link post-thumbnail to original img in a lightbox?
- Images stopped loadding after adding SSl
- Add padding while generating thumbnail
- Setup Featured image on all posts from thesis thesis_post_image custom field?
- Gallery with thumbnail carousel
- How to fit image to Thumbnail canvas size?
- Bulk-add featured images in posts with no featured image
- Should I not compress my jpeg files before uploading to avoid double compression?
- Is it possible to preserve original images in order to change image size later?
- Generating a certain sized thumbnail on the fly?
- How do you import images from a URL in your post?
- add_image_size function not working
- How do I get a smaller size of an avatar image
- What sense makes medium_large_size_h => 0?
- Stop WordPress compressing images? – Quality is terrible
- How do I link a featured photo to it’s post?
- Is it possible to enable the ‘Link To’ field under ‘Attachment Display Settings’ for a Featured Image?
- Using Image Sizes for Custom Post Types outside the Loop
- Use default image as var
- Placing a featured image into header
- How do I display the featured image from an image gallery using a reference in code? (example within)
- Using different size thumbnails on different parts of my site… with functions.php?
- attach several images to post + gallery
- how to change format jpg to webp?
- Images not showing after wordpres update 5.6
- Display Multiple Photos as Featured Image when mouse moves on to it post
- how to regenerate webp et-pb-portfolio-image
- How to echo images Urls from a wordpress post, that are relally in the post
- Force WordPress to always generate a thumbnail for original image
- Get post thumbnail in specific size
- When upload a PNG a noise appears in the thumbnails
- Thumbnails are hard cropped not matter what
- Featured image size always cropped bottom
- Blank image thumbnails in media library
- How to set a post featured image from an already made custom field
- featured image in custom poste type (backend)
- stop wordpress from resizing feature gif images
- Does WordPress have a way of changing the ‘Natural’ size of uploaded images?
- Image thumbnail on single product issue | WooCommerce
- Declare global variable that can be used on other function
- Trouble Retrieving Thumbnail URL on Front-Page
- Why are my ‘medium’ images the wrong size
- Black and White Thumbnail in WordPress Gallery
- Getting top Image From the Gallery and printing out a thumbnail with Exact Dimensions
- Add custom version to an image
- Delete all thumbnails & regenerate them?
- Media Library shows default image instead of image preview
- WordPress pointing animated GIF images with wrong file name upon upload (GIFs animation not working)
- Edit multiple posts featured image