Skip to content

Instantly share code, notes, and snippets.

@norcross
Created January 21, 2015 02:08
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save norcross/8f85522502102461a062 to your computer and use it in GitHub Desktop.
Save norcross/8f85522502102461a062 to your computer and use it in GitHub Desktop.
filter content to rewrite image src to https
<?php
add_filter( 'the_content', 'rkv_force_https_images', 10 );
/**
* check image URLs and force https on them
*
* @param [type] $content [description]
*/
function rkv_force_https_images( $content ) {
return str_replace( 'src="http://css-tricks.com', 'src="https://css-tricks.com', $content );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment