wppaste
WordPress

WP_Site_Health::get_test_https_status(): array

Since
5.2.0, 5.7.0
Source
wp-admin/includes/class-wp-site-health.php:1463
Tests if the site is serving content over HTTPS.

Description

Many sites have varying degrees of HTTPS support, the most common of which is sites that have it enabled, but only if you visit the right site address.

Return

array
The test results.

Uses · 14

Show all 14

Source

	public function get_test_https_status() {		/*		 * Check HTTPS detection results.		 */		$errors = wp_get_https_detection_errors(); 		$default_update_url = wp_get_default_update_https_url(); 		$result = array(			'label'       => __( 'Your website is using an active HTTPS connection' ),			'status'      => 'good',			'badge'       => array(				'label' => __( 'Security' ),				'color' => 'blue',			),			'description' => sprintf(				'<p>%s</p>',				__( 'An HTTPS connection is a more secure way of browsing the web. Many services now have HTTPS as a requirement. HTTPS allows you to take advantage of new features that can increase site speed, improve search rankings, and gain the trust of your visitors by helping to protect their online privacy.' )			),			'actions'     => sprintf(				'<p><a href="%s" target="_blank">%s<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',				esc_url( $default_update_url ),				__( 'Learn more about why you should use HTTPS' ),				/* translators: Hidden accessibility text. */				__( '(opens in a new tab)' )			),			'test'        => 'https_status',		); 		if ( ! wp_is_using_https() ) {			/*			 * If the website is not using HTTPS, provide more information			 * about whether it is supported and how it can be enabled.			 */			$result['status'] = 'recommended';			$result['label']  = __( 'Your website does not use HTTPS' ); 			if ( wp_is_site_url_using_https() ) {				if ( is_ssl() ) {					$result['description'] = sprintf(						'<p>%s</p>',						sprintf(							/* translators: %s: URL to Settings > General > Site Address. */							__( 'You are accessing this website using HTTPS, but your <a href="%s">Site Address</a> is not set up to use HTTPS by default.' ),							esc_url( admin_url( 'options-general.php' ) . '#home' )						)					);				} else {					$result['description'] = sprintf(						'<p>%s</p>',						sprintf(							/* translators: %s: URL to Settings > General > Site Address. */							__( 'Your <a href="%s">Site Address</a> is not set up to use HTTPS.' ),							esc_url( admin_url( 'options-general.php' ) . '#home' )						)					);				}			} else {				if ( is_ssl() ) {					$result['description'] = sprintf(						'<p>%s</p>',						sprintf(							/* translators: 1: URL to Settings > General > WordPress Address, 2: URL to Settings > General > Site Address. */							__( 'You are accessing this website using HTTPS, but your <a href="%1$s">WordPress Address</a> and <a href="%2$s">Site Address</a> are not set up to use HTTPS by default.' ),							esc_url( admin_url( 'options-general.php' ) . '#siteurl' ),							esc_url( admin_url( 'options-general.php' ) . '#home' )						)					);				} else {					$result['description'] = sprintf(						'<p>%s</p>',						sprintf(							/* translators: 1: URL to Settings > General > WordPress Address, 2: URL to Settings > General > Site Address. */							__( 'Your <a href="%1$s">WordPress Address</a> and <a href="%2$s">Site Address</a> are not set up to use HTTPS.' ),							esc_url( admin_url( 'options-general.php' ) . '#siteurl' ),							esc_url( admin_url( 'options-general.php' ) . '#home' )						)					);				}			}

History

Introduced in 5.2.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

5.7.0
Updated to rely on wp_is_using_https() and wp_is_https_supported().from the docblock
5.2.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-admin/includes/class-wp-site-health.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.