diff --git a/wp-admin/includes/update-core.php b/wp-admin/includes/update-core.php index 9f17a086d9..4a077dc62c 100644 --- a/wp-admin/includes/update-core.php +++ b/wp-admin/includes/update-core.php @@ -1076,7 +1076,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