diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php index ec909143dd..fc6681acb3 100644 --- a/src/wp-admin/includes/update-core.php +++ b/src/wp-admin/includes/update-core.php @@ -1143,7 +1143,11 @@ function update_core( $from, $to ) { 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