wp_is_https_supported

函式
wp_is_https_supported ( No parameters )
返回值
  • (bool) True if HTTPS is supported, false otherwise.
定義位置
相關方法
wp_http_supportswp_list_sortwp_timezone_supportedpost_type_supportsis_site_meta_supported
引入
5.7.0
棄用
-

wp_is_https_supported: 這個函式用來檢查WordPress網站是否支援HTTPS。它檢查PHP安裝是否支援HTTPS,網站是否安裝了SSL證書。

檢查伺服器和域是否支援HTTPS。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_is_https_supported() {
$https_detection_errors = get_option( 'https_detection_errors' );
// If option has never been set by the Cron hook before, run it on-the-fly as fallback.
if ( false === $https_detection_errors ) {
wp_update_https_detection_errors();
$https_detection_errors = get_option( 'https_detection_errors' );
}
// If there are no detection errors, HTTPS is supported.
return empty( $https_detection_errors );
}
function wp_is_https_supported() { $https_detection_errors = get_option( 'https_detection_errors' ); // If option has never been set by the Cron hook before, run it on-the-fly as fallback. if ( false === $https_detection_errors ) { wp_update_https_detection_errors(); $https_detection_errors = get_option( 'https_detection_errors' ); } // If there are no detection errors, HTTPS is supported. return empty( $https_detection_errors ); }
function wp_is_https_supported() {
	$https_detection_errors = get_option( 'https_detection_errors' );

	// If option has never been set by the Cron hook before, run it on-the-fly as fallback.
	if ( false === $https_detection_errors ) {
		wp_update_https_detection_errors();

		$https_detection_errors = get_option( 'https_detection_errors' );
	}

	// If there are no detection errors, HTTPS is supported.
	return empty( $https_detection_errors );
}

常見問題

FAQs
檢視更多 >