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。

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
查看更多 >