[WordPress] リンクを https に変更する

function rewrite_https( $content ) {
	if ( !is_ssl() )
		return $content ;

	$site = preg_replace('/^https?:\/\//i', '', site_url() );
	return preg_replace( '/http:\/\/(' . preg_quote($site, '/') . ')/i', 'https://$1', $content );
}
add_filter( 'script_loader_src', 'rewrite_https' );
add_filter( 'style_loader_src', 'rewrite_https' );
add_filter( 'the_excerpt', 'rewrite_https' );
add_filter( 'the_content', 'rewrite_https' );