WordPress at Your Fingertips
function is not described

WP_Filesystem_SSH2::sftp_path() public WP 4.4.0

Gets the ssh2.sftp PHP stream wrapper path to open for the given file.

This method also works around a PHP bug where the root directory (/) cannot be opened by PHP functions, causing a false failure. In order to work around this, the path is converted to /./ which is semantically the same as / See https://bugs.php.net/bug.php?id=64169 for more details.

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

No Hooks.

Return

String. The ssh2.sftp:// wrapped path to use.

Usage

$WP_Filesystem_SSH2 = new WP_Filesystem_SSH2();
$WP_Filesystem_SSH2->sftp_path( $path );
$path(string) (required)
The File/Directory path on the remote server to return

Changelog

Since 4.4.0 Introduced.

Code of WP_Filesystem_SSH2::sftp_path() WP 5.8.2

public function sftp_path( $path ) {
	if ( '/' === $path ) {
		$path = '/./';
	}

	return 'ssh2.sftp://' . $this->sftp_link . '/' . ltrim( $path, '/' );
}