How to Remove srcset value that cause image not shown on WordPress

Have you guys able to experienced this problem, this actually happen after you activated your SSL certificate, in other words your site run on https url already. And you’re so happy because you already secured your website connection but found out that urrrrgh the images on your blog posts were broken and then viewed the codes on firebug and there’s a srcset value automatically added and the fact that you don’t have any idea why it was there. So here i found some solution on how to remove those srcset value on your image, hope this will work for you.

On your function.php file, simply add this code.

function crset_disable_srcset( $sources ) {
    return false;
}
 
add_filter( 'wp_calculate_image_srcset', 'crset_disable_srcset' ); 
Scroll To Top