Last active
December 12, 2015 12:33
-
-
Save hinaloe/ed44367ce4cc84de56df to your computer and use it in GitHub Desktop.
WordPress 4.4 Responsive Images srcset SSL sample
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
<?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