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

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


$capabilities array Optional
Array of capabilities to test or a wp_remote_request() $args array.
More Arguments from wp_remote_request( ... $args ) Array or string of HTTP request arguments.
  • method string
    Request method. Accepts 'GET', 'POST', 'HEAD', 'PUT', 'DELETE', 'TRACE', 'OPTIONS', or 'PATCH'.
    Some transports technically allow others, but should not be assumed. Default 'GET'.
  • timeout float
    How long the connection should stay open in seconds. Default 5.
  • redirection int
    Number of allowed redirects. Not supported by all transports.
    Default 5.
  • httpversion string
    Version of the HTTP protocol to use. Accepts '1.0' and '1.1'.
    Default '1.0'.
  • user-agent string
    User-agent value sent.
    Default 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ).
  • reject_unsafe_urls bool
    Whether to pass URLs through wp_http_validate_url() .
    Default false.
  • blocking bool
    Whether the calling code requires the result of the request.
    If set to false, the request will be sent to the remote server, and processing returned to the calling code immediately, the caller will know if the request succeeded or failed, but will not receive any response from the remote server. Default true.
  • headers string|array
    Array or string of headers to send with the request.
  • cookies array
    List of cookies to send with the request.
  • body string|array
    Body to send with the request. Default null.
  • compress bool
    Whether to compress the $body when sending the request.
    Default false.
  • decompress bool
    Whether to decompress a compressed response. If set to false and compressed content is returned in the response anyway, it will need to be separately decompressed. Default true.
  • sslverify bool
    Whether to verify SSL for the request. Default true.
  • sslcertificates string
    Absolute path to an SSL certificate .crt file.
    Default ABSPATH . WPINC . '/certificates/ca-bundle.crt'.
  • stream bool
    Whether to stream to a file. If set to true and no filename was given, it will be dropped it in the WP temp dir and its name will be set using the basename of the URL. Default false.
  • filename string
    Filename of the file to write to when streaming. $stream must be set to true. Default null.
  • limit_response_size int
    Size in bytes to limit the response to. Default null.

Default: array()

$url string Optional
If given, will check if the URL requires SSL and adds that requirement to the capabilities array.

Default: null

Top ↑



Top ↑


File: wp-includes/http.php. View all references

function wp_http_supports( $capabilities = array(), $url = null ) {
	$http = _wp_http_get_object();

	$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 );

Top ↑


Version Description
3.2.0 Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.