Created
April 5, 2016 15:41
-
-
Save theJasonJones/5f1953c429598f2863cd187e4b43c166 to your computer and use it in GitHub Desktop.
Force URLs in srcset attributes into HTTPS scheme. A.K.A Fix for WP 4.4 responsive images.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Force URLs in srcset attributes into HTTPS scheme. | |
*/ | |
function ssl_srcset( $sources ) { | |
foreach ( $sources as &$src ) { | |
$src['url'] = set_url_scheme( $src['url'], 'https' ); | |
} | |
return $sources; | |
} | |
add_filter( 'wp_calculate_image_srcset', 'ssl_srcset' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment