wp_is_site_url_using_https() WordPress Function

The wp_is_site_url_using_https() function is used to check if the current site is using a secure SSL connection. This is useful for checking if a user's login credentials are being sent over a secure connection.

wp_is_site_url_using_https() #

Checks whether the current site’s URL where WordPress is stored is using HTTPS.


Description

This checks the URL where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible.

Top ↑

See also


Top ↑

Return

(bool) True if using HTTPS, false otherwise.


Top ↑

Source

File: wp-includes/https-detection.php

function wp_is_site_url_using_https() {
	// Use direct option access for 'siteurl' and manually run the 'site_url'
	// filter because `site_url()` will adjust the scheme based on what the
	// current request is using.
	/** This filter is documented in wp-includes/link-template.php */
	$site_url = apply_filters( 'site_url', get_option( 'siteurl' ), '', null, null );

	return 'https' === wp_parse_url( $site_url, PHP_URL_SCHEME );
}


Top ↑

Changelog

Changelog
VersionDescription
5.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.