Exclude original from responsive images srcset

I am trying to customise the searchset and exclude the original full size.
This is the code I am using (I want to include sizes up to large, 1860px):

add_filter( ‘max_srcset_image_width’, ‘my_max_srcset_image_width’, 10 , 2 );
function my_max_srcset_image_width() {
return 1860;
function responsive_image_large($image_id){
$image_size = “large”;
if($image_id != ”) {
$image_src = wp_get_attachment_image_url( $image_id, $image_size );
$image_srcset = wp_get_attachment_image_srcset( $image_id, $image_size );
$rimg = ‘src=”‘.$image_src.'” srcset=”‘.$image_srcset.'” sizes=”(max-width: 1860px) 100vw, 1860px’;
return $rimg;

Unfortunately wp_get_attachment_image_srcset also includes the original full size.

Read more here:: Exclude original from responsive images srcset

Leave a Reply

Your email address will not be published. Required fields are marked *