mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Make a new function, wp_delete_file(). Use it.
Props scribu, wonderboymusic. Fixes #17864. git-svn-id: https://develop.svn.wordpress.org/trunk@31575 602fd350-edb4-49c9-b593-d223f7449a82
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