The WP Discourse plugin isn’t setup to handle this, but it should be possible.
I’d start by adding a site URL parameter to the Discourse discourse_connect_url setting. On WordPress, use the site parameter to set the correct Discourse site to redirect to here:
You would probably also need to deal with the call to sync_sso that happens here: wp-discourse/lib/sso-provider/discourse-sso.php at main · discourse/wp-discourse · GitHub
I’m not certain about this, but you might need to add site to the allowed query vars in this function (so that WordPress doesn’t remove the parameter): wp-discourse/lib/sso-provider/discourse-sso.php at main · discourse/wp-discourse · GitHub
Ideally the above changes could be accomplished with action and filter hooks on WordPress. It looks like hooks would need to be added to the code for that.
I’m assuming that the spec for this doesn’t involve publishing posts from WordPress to multiple Discourse sites. If that’s the case, the required changes would be a little more involved.
I’ll let you know if I think of any other issues.
Edit: need to think about how the Discourse user id is used on WordPress to make sure there won’t be any conflicts between multiple sites - a single user on WordPress could potentially have accounts on multiple WordPress sites. They would have a different Discourse user id on each site.
Edit: the biggest issue I can see is if the “Create or Sync Discourse Users on Login” setting is enabled on the WordPress sites. It makes an API call to the Discourse sync_sso route. You’d need to have a way of knowing which Discourse site to sync or create the user on. You’d also need to have a Discourse API key for each site. This seems doable, but would add some complexity.