wp_delete_file() WordPress Function
The wp_delete_file function is a WordPress function that allows you to delete a file. This function will delete a file from the WordPress uploads directory.
wp_delete_file( string $file ) #
Delete a file
Parameters
- $file
(string)(Required)The path to the file to delete.
Source
File: wp-includes/functions.php
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 );
}
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 4.2.0 | Introduced. |