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:
Scott Taylor
2015-02-27 16:51:25 +00:00
parent 295af37bd0
commit f6b1b01ecd
5 changed files with 32 additions and 30 deletions

View File

@@ -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 );
}
}