tessguefen
2/3/2016 - 3:25 PM

WordPress // HTTP & Image Links

WordPress // HTTP & Image Links

<?php if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { ?>
  <base href="https://<?php echo $hostname; ?>/mm5/" />
<?php } else { ?>
  <base href="http://<?php echo $hostname; ?>/mm5/" />
<?php } ?>
function replace_content($content) {
	$search  = array('http://www.myurl.com/blog/wp-content/uploads/');
	$replace = array('//www.myurl.com/blog/wp-content/uploads/');
	// We only want to get the images, not every single link
	$content = str_replace($search, $replace, $content);
	return $content;
}
add_filter('the_content', 'replace_content');
add_filter('the_excerpt', 'replace_content');