wp_is_stream()WP 3.5.0

Tests if a given path is a stream URL

No Hooks.

Return

true|false. True if the path is a stream URL.

Usage

wp_is_stream( $path );
$path(string) (required)
The resource path or URL.

Changelog

Since 3.5.0 Introduced.

wp_is_stream() code WP 6.5.2

function wp_is_stream( $path ) {
	$scheme_separator = strpos( $path, '://' );

	if ( false === $scheme_separator ) {
		// $path isn't a stream.
		return false;
	}

	$stream = substr( $path, 0, $scheme_separator );

	return in_array( $stream, stream_get_wrappers(), true );
}