filter_SSL()WP 2.8.5

Formats a URL to use https.

Useful as a filter.

No Hooks.

Return

String. URL with https as the scheme.

Usage

filter_SSL( $url );
$url(string) (required)
URL.

Changelog

Since 2.8.5 Introduced.

filter_SSL() code WP 6.4.3

function filter_SSL( $url ) {  // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
	if ( ! is_string( $url ) ) {
		return get_bloginfo( 'url' ); // Return home site URL with proper scheme.
	}

	if ( force_ssl_content() && is_ssl() ) {
		$url = set_url_scheme( $url, 'https' );
	}

	return $url;
}