File_Upload_Upgrader::cleanup()publicWP 3.2.2

Deletes the attachment/uploaded file.

Method of the class: File_Upload_Upgrader{}

No Hooks.

Return

true|false. Whether the cleanup was successful.

Usage

$File_Upload_Upgrader = new File_Upload_Upgrader();
$File_Upload_Upgrader->cleanup();

Changelog

Since 3.2.2 Introduced.

File_Upload_Upgrader::cleanup() code WP 6.5.2

public function cleanup() {
	if ( $this->id ) {
		wp_delete_attachment( $this->id );

	} elseif ( file_exists( $this->package ) ) {
		return @unlink( $this->package );
	}

	return true;
}