Determines if SSL is used.

Description Description

Return Return

(bool) True if SSL, otherwise false.

Top ↑

Source Source

File: wp-includes/load.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;

Top ↑

Changelog Changelog

Version Description
4.6.0 Moved from functions.php to load.php.
2.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Codex

    With load balancers

    It won’t work for websites behind some load balancers, especially Network Solutions hosted websites. To bodgy up a fix, save this gist into the plugins folder and enable it. For details, read “WordPress is_ssl() doesn’t work behind some load balancers.”

    Websites behind load balancers or reverse proxies that support HTTP_X_FORWARDED_PROTO can be fixed by adding the following code to the wp-config.php file, above the require_once call:

        $_SERVER['HTTPS'] = 'on';

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