WP_Filesystem_SSH2::exists() WordPress Method
The WP_Filesystem_SSH2::exists() method is used to check whether a given file or directory exists on the server. This is useful for making sure that a file or directory exists before attempting to perform operations on it.
WP_Filesystem_SSH2::exists( string $file ) #
Checks if a file or directory exists.
Parameters
- $file
(string)(Required)Path to file or directory.
Return
(bool) Whether $file exists or not.
Source
File: wp-admin/includes/class-wp-filesystem-ssh2.php
public function exists( $file ) { return file_exists( $this->sftp_path( $file ) ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
2.7.0 | Introduced. |