WP_Filesystem_ftpsockets::delete() – Deletes a file or directory.

You appear to be a bot. Output may be restricted

Description

Deletes a file or directory.

Usage

$bool = WP_Filesystem_ftpsockets::delete( $file, $recursive, $type );

Parameters

$file
( string ) required – Path to the file or directory.
$recursive
( bool ) optional – Optional. If set to true, deletes files and folders recursively. Default false.
$type
( string|false ) optional – Type of resource. 'f' for file, 'd' for directory. Default false.

Returns

bool True on success, false on failure.

Source

File name: wordpress/wp-admin/includes/class-wp-filesystem-ftpsockets.php
Lines:

1 to 15 of 15
  public function delete( $file, $recursive = false, $type = false ) {
    if ( empty( $file ) ) {
      return false;
    }

    if ( 'f' === $type || $this->WP_Filesystem_ftpsockets::is_file( $file ) ) {
      return $this->ftp->WP_Filesystem_ftpsockets::delete( $file );
    }

    if ( ! $recursive ) {
      return $this->ftp->WP_Filesystem_ftpsockets::rmdir( $file );
    }

    return $this->ftp->mdel( $file );
  }
 

 View on GitHub View on Trac