function filter_SSL( $url ) {}

Formats an String URL to use HTTPS if HTTP is found.
Useful as a filter.


  • $url

Source code

function filter_SSL( $url ) {

	if ( !is_string( $url ) )

		return get_bloginfo( 'url' ); //return home blog url with proper scheme

	$arrURL = parse_url( $url );

	if ( force_ssl_content() && is_ssl() ) {

		if ( 'http' === $arrURL['scheme'] && 'https' !== $arrURL['scheme'] )

			$url = str_replace( $arrURL['scheme'], 'https', $url );


	return $url;



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: