wppaste
WordPress

WP_Filesystem_Direct::copy( string $source, string $destination, bool $overwrite = false, int|false $mode = false ): bool

Since
2.5.0
Source
wp-admin/includes/class-wp-filesystem-direct.php:304
Copies a file.

Parameters

$sourcestring
Path to the source file.
$destinationstring
Path to the destination file.
$overwritebooloptional
Whether to overwrite the destination file if it exists. Default false.Default: false
$modeint|falseoptional
The permissions as octal number, usually 0644 for files, 0755 for dirs. Default false.Default: false

Return

bool
True on success, false on failure.

Uses · 2

Used by · 1

Source

	public function copy( $source, $destination, $overwrite = false, $mode = false ) {		if ( ! $overwrite && $this->exists( $destination ) ) {			return false;		} 		$rtval = copy( $source, $destination ); 		if ( $mode ) {			$this->chmod( $destination, $mode );		} 		return $rtval;	}

History

Introduced in 2.5.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-admin/includes/class-wp-filesystem-direct.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.