wp_http_supports

Advertisement

Summery Summery

Determines if there is an HTTP Transport that can process this request.

Syntax Syntax

wp_http_supports( array $capabilities = array(), string $url = null )

Parameters Parameters

$capabilities

(Optional) Array of capabilities to test or a wp_remote_request() $args array.

Default value: array()

$url

(Optional) If given, will check if the URL requires SSL and adds that requirement to the capabilities array.

Default value: null

Return Return

(bool)

Source Source

File: wp-includes/http.php

	$capabilities = wp_parse_args( $capabilities );

	$count = count( $capabilities );

	// If we have a numeric $capabilities array, spoof a wp_remote_request() associative $args array.
	if ( $count && count( array_filter( array_keys( $capabilities ), 'is_numeric' ) ) == $count ) {
		$capabilities = array_combine( array_values( $capabilities ), array_fill( 0, $count, true ) );
	}

	if ( $url && ! isset( $capabilities['ssl'] ) ) {
		$scheme = parse_url( $url, PHP_URL_SCHEME );
		if ( 'https' === $scheme || 'ssl' === $scheme ) {
			$capabilities['ssl'] = true;
		}
	}

	return (bool) $http->_get_first_available_transport( $capabilities );
}

/**

Advertisement

Changelog Changelog

Changelog
Version Description
3.2.0 Introduced.

Advertisement

Leave a Reply