You can automate this process. I think the links that are pointing to the old Discourse domain that you are referring to are the links to Discourse topics that appear underneath WordPress posts. These links are set by the post’s discourse_permalink post_meta field. You could try manually updating that field for one of your posts to confirm that solves the issue:
There are a few WordPress plugins that can automate the process of remapping this field. In the past, I’ve used the Velvet Blues Update URLs plugin. It seems that plugin is no longer supported. There is a forked version of it that I haven’t tried: Search & Replace Everything – Quick and Easy Way to Find and Replace Text, Links – WordPress plugin | WordPress.org. I’ve also seen this plugin recommended: Better Search Replace – WordPress plugin | WordPress.org English (Canada).
The main thing to be aware of is that you need to use a remapping plugin that is able to update post custom fields. I think both of the plugins I linked to can do that. I’d also look for a plugin that lets you perform a dry run before performing the actual remapping. The second plugin that I linked to says it supports that.
Be sure to save a fresh backup of your WordPress database before running the remap. It would also be good to try manually updating the discourse_permalink field for just one post to confirm that solves the issue for you.
