Skip to content

Instantly share code, notes, and snippets.

@thomasmb
Last active March 27, 2018 07:14
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save thomasmb/6380294 to your computer and use it in GitHub Desktop.
Save thomasmb/6380294 to your computer and use it in GitHub Desktop.
Simple filter for adding https support to wp_get_attachment_url in WordPress
<?php
add_filter( 'wp_get_attachment_url', function( $url, $id ){
if( is_ssl() )
$url = str_replace( 'http://', 'https://', $url );
return $url;
});
@Aternus
Copy link

Aternus commented Dec 14, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment