Uses
| Uses | Description |
|---|---|
| wp-admin/includes/class-wp-filesystem-ftpext.php: WP_Filesystem_FTPext::is_dir() | Checks if resource is a directory. |
Checks if a file or directory exists.
(string) (Required) Path to file or directory.
(bool) Whether $file exists or not.
File: wp-admin/includes/class-wp-filesystem-ftpext.php
public function exists( $file ) {
$list = ftp_nlist( $this->link, $file );
if ( empty( $list ) && $this->is_dir( $file ) ) {
return true; // File is an empty directory.
}
return ! empty( $list ); // Empty list = no file, so invert.
} | Version | Description |
|---|---|
| 2.5.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_filesystem_ftpext/exists