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:
Scott Taylor
2015-02-27 16:50:14 +00:00
parent 65c58832cb
commit 212d6d8046
4 changed files with 31 additions and 29 deletions

View File

@@ -882,19 +882,11 @@ wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
// Cleanup.
$medium = str_replace( basename( $original ), 'midsize-' . basename( $original ), $original );
if ( file_exists( $medium ) ) {
/**
* Filter the path of the file to delete.
*
* @since 2.1.0
*
* @param string $medium Path to the file to delete.
*/
@unlink( apply_filters( 'wp_delete_file', $medium ) );
wp_delete_file( $medium );
}
if ( empty( $_POST['create-new-attachment'] ) && empty( $_POST['skip-cropping'] ) ) {
/** This filter is documented in wp-admin/custom-header.php */
@unlink( apply_filters( 'wp_delete_file', $original ) );
wp_delete_file( $original );
}
return $this->finished();