Wordpress account completely deleted when username is changed in Discourse (SSO with WP as Provider)

The only changes that the WP Discourse plugin makes to a WordPress user when WordPress is the SSO provider for Discourse is to add discourse_sso_user_id and discourse_username meta-data fields to the user. The plugin does not do anything that I know of that would cause a WordPress user to be deleted from the database when they change their username on Discourse.

The only consequence of a user changing their username on Discourse that I know of is that the user’s Discourse Username that is stored on WordPress could get out of sync with the user’s actual Discourse username. If this happened, it would affect the user’s ability to publish posts to Discourse. It should not cause any problems with SSO login. It should definitely not cause the user to be deleted from the WordPress database.

This is a WordPress issue, not a Discourse one, but I would not recommend using a plugin to override basic WordPress functionality. Usernames are not intended to be editable on WordPress. It would be best to stick with that default behaviour.