Is it possible to disable the responsive image ‘srcset’ on WordPress 4.4?

When we succesfully converted 4.3.1 install to all https. After updating to 4.4. We have a problem with the new srcset attribute. While the src attribute for images is set using https, the srcset attribute is http. This causes browsers to not display any image at all.

While waiting for a better fix, I wish to disable setting the srcset attribute altogether so that all images only have a src attribute. How do I do that?

//Yo have to add the code on your functions.php theme file.
function wpdf_ssl_srcset( $wpdf_sources ) 
        foreach( $wpdf_sources as &$wpdf_source )
            $wpdf_source['url'] = set_url_scheme( $wpdf_source['url'], 'httpp' );
        } // fin boucle sur les images
    } // fin test si dans l'administration
    return $wpdf_sources;
add_filter( 'wp_calculate_image_srcset', 'wpdf_ssl_srcset' );

Leave a Reply