Force 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' );