A WordPress-centric search engine for devs and theme authors



is_ssl ›

Since2.6.0
Deprecatedn/a
is_ssl ( No parameters )
Returns:
  • (bool) True if SSL, otherwise false.
Defined at:
Codex:
Change Log:
  • 4.6.0

Determines if SSL is used.



Source

function is_ssl() {
	if ( isset( $_SERVER['HTTPS'] ) ) {
		if ( 'on' == strtolower( $_SERVER['HTTPS'] ) ) {
			return true;
		}

		if ( '1' == $_SERVER['HTTPS'] ) {
			return true;
		}
	} elseif ( isset( $_SERVER['SERVER_PORT'] ) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
		return true;
	}
	return false;
}