File_Upload_Upgrader::cleanup() WordPress Method

The File_Upload_Upgrader::cleanup() method is used to clean up any uploaded files that are no longer needed. This is typically called after an upgrade has been completed.

File_Upload_Upgrader::cleanup() #

Delete the attachment/uploaded file.


Return

(bool) Whether the cleanup was successful.


Top ↑

Source

File: wp-admin/includes/class-file-upload-upgrader.php

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

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

		return true;
	}


Top ↑

Changelog

Changelog
VersionDescription
3.2.2Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.