WordPress at Your Fingertips
function is not described

WP_Http::_get_first_available_transport() public WP 3.2.0

Tests which transports are capable of supporting the request.

{} It's a method of the class: WP_Http{}

Hooks from the method

String|false. Class name for the first transport that claims to support the request. False if no transport claims to support the request.


$WP_Http = new WP_Http();
$WP_Http->_get_first_available_transport( $args, $url );
$args(array) (required)
Request arguments.
URL to request.


Since 3.2.0 Introduced.

Code of WP_Http::_get_first_available_transport() WP 5.7.2

public function _get_first_available_transport( $args, $url = null ) {
	$transports = array( 'curl', 'streams' );

	 * Filters which HTTP transports are available and in what order.
	 * @since 3.7.0
	 * @param string[] $transports Array of HTTP transports to check. Default array contains
	 *                             'curl' and 'streams', in that order.
	 * @param array    $args       HTTP request arguments.
	 * @param string   $url        The URL to request.
	$request_order = apply_filters( 'http_api_transports', $transports, $args, $url );

	// Loop over each transport on each HTTP request looking for one which will serve this request's needs.
	foreach ( $request_order as $transport ) {
		if ( in_array( $transport, $transports, true ) ) {
			$transport = ucfirst( $transport );
		$class = 'WP_Http_' . $transport;

		// Check to see if this transport is a possibility, calls the transport statically.
		if ( ! call_user_func( array( $class, 'test' ), $args, $url ) ) {

		return $class;

	return false;