Skip to content

Instantly share code, notes, and snippets.

@brokkr
Created December 10, 2015 10:40
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 brokkr/76077a0b9634b8be98ae to your computer and use it in GitHub Desktop.
Save brokkr/76077a0b9634b8be98ae to your computer and use it in GitHub Desktop.
<?php
/**
* SSL for media library
*/
function have_https_for_media( $url ) {
if ( is_ssl() )
$url = str_replace( 'http://', 'https://', $url );
return $url;
}
add_filter( 'wp_get_attachment_url', 'have_https_for_media' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment