Skip to content

Instantly share code, notes, and snippets.

@hinaloe
Last active December 12, 2015 12:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hinaloe/ed44367ce4cc84de56df to your computer and use it in GitHub Desktop.
Save hinaloe/ed44367ce4cc84de56df to your computer and use it in GitHub Desktop.
WordPress 4.4 Responsive Images srcset SSL sample
<?php
add_filter('wp_calculate_image_srcset',function($sources, $size_array, $image_src, $image_meta, $attachment_id ) {
if ( is_ssl() )
{
foreach($sources as $size => &$source){
$source['url'] = set_url_scheme( $source['url'] ,'https');
}
}
return $sources;
}, 14, 5 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment