diff --git a/wp-admin/includes/update-core.php b/wp-admin/includes/update-core.php index a378d3ce95..6682544156 100644 --- a/wp-admin/includes/update-core.php +++ b/wp-admin/includes/update-core.php @@ -1081,7 +1081,11 @@ function update_core($from, $to) { $old_file = $to . $old_file; if ( !$wp_filesystem->exists($old_file) ) continue; - $wp_filesystem->delete($old_file, true); + + // If the file isn't deleted, try writing an empty string to the file instead. + if ( ! $wp_filesystem->delete( $old_file, true ) && $wp_filesystem->is_file( $old_file ) ) { + $wp_filesystem->put_contents( $old_file, '' ); + } } // Remove any Genericons example.html's from the filesystem