-
-
Save tharmann/f4aa6a0b78f1e8929fa3c3b1adc9b7a8 to your computer and use it in GitHub Desktop.
Force SSL for media library
This file contains hidden or 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
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