Skip to content

Instantly share code, notes, and snippets.

@spigotdesign
Last active May 7, 2018 14:59
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 spigotdesign/0f0c0ecfeb838017555d17a71c0fe915 to your computer and use it in GitHub Desktop.
Save spigotdesign/0f0c0ecfeb838017555d17a71c0fe915 to your computer and use it in GitHub Desktop.
Force WordPress Media button to insert https links
add_filter( ‘image_send_to_editor’, ‘force_protocol_relative’, 10, 9 );
function force_protocol_relative($content) {
$content = str_replace( ‘http://’, ‘https://’, $content );
return $content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment