Yes. After clicking the ‘login’ button on Discourse, users will be redirected to the URL you have set as the sso url on Discourse. This should be your site’s home URL.
If you are not already logged into WordPress, the SSO code will redirect you to your site’s login URL. This URL defaults to /wp-login.php. It can be overridden by setting the ‘Path to your login page’ option. After login, users should be redirected back to your site’s home URL, with the query parameters sent from Discourse intact.
If this isn’t working for you when you are not already logged into WordPress, the issue could be that you have a login redirect setup on your site that is overriding the login redirect set by the WP Discourse SSO code. Another possibility is that the query parameters set by Discourse are being stripped by your site’s login code.
You could use the wpdc_sso_params filter to override the username that is set by the plugin:
add_filter( 'wpdc_sso_params', 'wpdc_custom_sso_params', 10, 2 );
function wpdc_custom_sso_params( $params, $user ) {
$params['username'] = $user->user_nicename;
return $params;
}
For details about what is going on have a look at wp-discourse/lib/sso-provider/discourse-sso.php at main · discourse/wp-discourse · GitHub.