Make a new function, wp_delete_file(). Use it.
Props scribu, wonderboymusic. Fixes #17864. Built from https://develop.svn.wordpress.org/trunk@31575 git-svn-id: http://core.svn.wordpress.org/trunk@31556 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -4813,3 +4813,24 @@ function wp_validate_boolean( $var ) {
|
||||
|
||||
return (bool) $var;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a file
|
||||
*
|
||||
* @since 4.2.0
|
||||
*
|
||||
* @param string $file The path to the file to delete.
|
||||
*/
|
||||
function wp_delete_file( $file ) {
|
||||
/**
|
||||
* Filter the path of the file to delete.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*
|
||||
* @param string $medium Path to the file to delete.
|
||||
*/
|
||||
$delete = apply_filters( 'wp_delete_file', $file );
|
||||
if ( ! empty( $delete ) ) {
|
||||
@unlink( $delete );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user