wp_is_stream() WordPress Function

The wp_is_stream() function is used to check if a stream is a stream. This function is useful for checking if a stream is a stream before performing operations on it.

wp_is_stream( string $path ) #

Test if a given path is a stream URL


Parameters

$path

(string)(Required)The resource path or URL.


Top ↑

Return

(bool) True if the path is a stream URL.


Top ↑

Source

File: wp-includes/functions.php

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


Top ↑

Changelog

Changelog
VersionDescription
3.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More