url_is_accessable_via_ssl()WP 2.5.0

Устарела с версии 4.0.0. Больше не поддерживается и может быть удалена. Рекомендуется заменить эту функцию на аналог.

Determines if the URL can be accessed over SSL.

Determines if the URL can be accessed over SSL by using the WordPress HTTP API to access the URL using https as the scheme.

Хуков нет.

Возвращает

true|false. Whether SSL access is available.

Использование

url_is_accessable_via_ssl( $url );
$url(строка) (обязательный)
The URL to test.

Список изменений

С версии 2.5.0 Введена.
Устарела с 4.0.0

Код url_is_accessable_via_ssl() WP 6.5.2

function url_is_accessable_via_ssl( $url ) {
	_deprecated_function( __FUNCTION__, '4.0.0' );

	$response = wp_remote_get( set_url_scheme( $url, 'https' ) );

	if ( !is_wp_error( $response ) ) {
		$status = wp_remote_retrieve_response_code( $response );
		if ( 200 == $status || 401 == $status ) {
			return true;
		}
	}

	return false;
}