filter_SSL( string $url ): string

Formats a URL to use https.

Description

Useful as a filter.

Parameters

$urlstringrequired
URL.

Return

string URL with https as the scheme.

Source

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;
}

Changelog

VersionDescription
2.8.5Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.