wp_is_site_url_using_https

The timeline below displays how wordpress function wp_is_site_url_using_https has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Checks whether the current site's URL where WordPress is stored is using HTTPS.
 *
 * This checks the URL where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder)
 * are accessible.
 *
 * @since 5.7.0
 * @see site_url()
 *
 * @return bool True if using HTTPS, false otherwise.
 */
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);
}

WordPress Version: 5.8

/**
 * Checks whether the current site's URL where WordPress is stored is using HTTPS.
 *
 * This checks the URL where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder)
 * are accessible.
 *
 * @since 5.7.0
 * @see site_url()
 *
 * @return bool True if using HTTPS, false otherwise.
 */
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);
}

WordPress Version: 5.7

/**
 * Checks whether the current site's URL where WordPress is stored is using HTTPS.
 *
 * This checks the URL where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are
 * accessible.
 *
 * @since 5.7.0
 * @see site_url()
 *
 * @return bool True if using HTTPS, false otherwise.
 */
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);
}