WordPress at a glance

is_ssl() WP 1.0

Determines if SSL is used.

  • Since 4.6.0 Moved from functions.php to load.php.
Is the basis for: set_url_scheme()
✈ 1 time = 0.000012s = very fast | 50000 times = 0.02s = speed of light

No Hooks.

Return

true/false. True if SSL, otherwise false.

Usage

is_ssl();

Code of is_ssl: wp-includes/load.php VER 4.9.8

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

Related Functions

From tag: Site security (safety)

More from tag: Conditional tags (page type and request)

More from tag: Conditional tags (all)

More from category: Site Options (settings)

More from Template Tags: Main Functions

No comments
    Hello, !     Log In . Register