Title: filter_SSL
Published: April 25, 2014
Last modified: April 28, 2025

---

# filter_SSL( string $url ): string

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/filter_ssl/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/filter_ssl/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/filter_ssl/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/filter_ssl/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/filter_ssl/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/filter_ssl/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/filter_ssl/?output_format=md#wp--skip-link--target)

Formats a URL to use https.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/filter_ssl/?output_format=md#description)󠁿

Useful as a filter.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/filter_ssl/?output_format=md#parameters)󠁿

 `$url`stringrequired

URL.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/filter_ssl/?output_format=md#return)󠁿

 string URL with https as the scheme.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/filter_ssl/?output_format=md#source)󠁿

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/ms-functions.php#L2448)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/ms-functions.php#L2448-L2458)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/filter_ssl/?output_format=md#related)󠁿

| Uses | Description | 
| [is_ssl()](https://developer.wordpress.org/reference/functions/is_ssl/)`wp-includes/load.php` |

Determines if SSL is used.

  | 
| [set_url_scheme()](https://developer.wordpress.org/reference/functions/set_url_scheme/)`wp-includes/link-template.php` |

Sets the scheme for a URL.

  | 
| [force_ssl_content()](https://developer.wordpress.org/reference/functions/force_ssl_content/)`wp-includes/ms-functions.php` |

Determines whether to force SSL on content.

  | 
| [get_bloginfo()](https://developer.wordpress.org/reference/functions/get_bloginfo/)`wp-includes/general-template.php` |

Retrieves information about the current site.

  |

[Show 1 more](https://developer.wordpress.org/reference/functions/filter_ssl/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/filter_ssl/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/filter_ssl/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.8.5](https://developer.wordpress.org/reference/since/2.8.5/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Ffilter_ssl%2F)
before being able to contribute a note or feedback.