wp_delete_file( string $file )

Deletes a file.

Parameters

$filestringrequired
The path to the file to delete.

Source

function wp_delete_file( $file ) {
	/**
	 * Filters the path of the file to delete.
	 *
	 * @since 2.1.0
	 *
	 * @param string $file Path to the file to delete.
	 */
	$delete = apply_filters( 'wp_delete_file', $file );
	if ( ! empty( $delete ) ) {
		@unlink( $delete );
	}
}

Hooks

apply_filters( ‘wp_delete_file’, string $file )

Filters the path of the file to delete.

Changelog

VersionDescription
4.2.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.