# Discourse WordPress plugin does not auto login user on alias domain

**URL:** https://meta.discourse.org/t/discourse-wordpress-plugin-does-not-auto-login-user-on-alias-domain/341744
**Category:** WordPress
**Created:** [December 11, 2024, 4:49am UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-does-not-auto-login-user-on-alias-domain/341744 "2024-12-11T04:49:28Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Himanshu\_Singh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/himanshu_singh/32/216438_2.png) [@Himanshu\_Singh](https://meta.discourse.org/u/Himanshu_Singh)
#### Post date: [December 11, 2024, 4:49am UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-does-not-auto-login-user-on-alias-domain/341744/1 "2024-12-11T04:49:28Z")

</div>

Hello everyone,  
We have a WordPress customization scenario that is breaking Discourse plugin functionality.

Scenario

1. My site is WordPress site. Let’s say [abc.com](http://abc.com)
2. I have Discourse WordPress plugin installed and it works just fine to login to Discourse _after_ I have logged into WordPress. I have to just click on the login button on Discourse and the user is auto logged in.
3. The community is hosted on [community.abc.com](http://community.abc.com)
4. Now I have created a domain alias for my site as a white label solution for one of my client. Let’s say the new domain is [abc.client.com](http://abc.client.com)
5. This new domain allows the client to access the site in a completely white label manner. We don’t want then to access any content via the [abc.com](http://abc.com) domain.
6. Now, when the user from the client side logs in to [abc.client.com](http://abc.client.com) (wordpress white label site), and then clicks on the community link, they are directed to [community.abc.com](http://community.abc.com).
7. When the user clicks on login button on the community they are not auto logged in to the discourse site, and instead the page is redirected to [abc.com/login/?redirect\_to=%2Flogin%3Fsso](http://abc.com/login/?redirect_to=%2Flogin%3Fsso)…
8. This redirection is not desirable as user would have to login to [abc.com](http://abc.com) and then only access [community.abc.com](http://community.abc.com)
9. Question – is there a way to login to the discourse community after the user logs in to [abc.client.com](http://abc.client.com) ?

This might be an issue related to the change in webhook as the domain alias used. Is there a workaround to make it happen? Does the user have to logged into [abc.com](http://abc.com) to be logged in to the discourse community? Can there be two domains that login to the same Discourse community?

Appreciate your support.

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [December 11, 2024, 8:26am UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-does-not-auto-login-user-on-alias-domain/341744/2 "2024-12-11T08:26:48Z")

</div>

Hello @Himanshu_Singh.

Firstly, I’m a little confused as to why you don’t just change the domain `abc.com` to `abc.client.com`? Why do you need two domains?

Secondly,

> [@Himanshu\_Singh](#):
>
> When the user clicks on login button on the community they are not auto logged in to the discourse site, and instead the page is redirected to [abc.com/login/?redirect\_to=%2Flogin%3Fsso](http://abc.com/login/?redirect_to=%2Flogin%3Fsso)…

The redirect link is determined by your `discourse connect url` site setting on `community.abc.com` which I’m guessing is still set to `abc.com`.

---

<div class="post-metadata">

### Author: ![Himanshu\_Singh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/himanshu_singh/32/216438_2.png) [@Himanshu\_Singh](https://meta.discourse.org/u/Himanshu_Singh)
#### Post date: [December 11, 2024, 4:33pm UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-does-not-auto-login-user-on-alias-domain/341744/3 "2024-12-11T16:33:47Z")

</div>

@angus Good

> [@angus](#):
>
> Firstly, I’m a little confused as to why you don’t just change the domain `abc.com` to `abc.client.com`? Why do you need two domains?

Good question – we are building multiple white label solutions for different partners so we will have multiple partner urls ([abc.client1.com](http://abc.client1.com), [abc.client2.com](http://abc.client2.com), and so on) while also keeping our main url for direct business ([abc.com](http://abc.com)). Think of these partners as affiliates who could use our product in their daily operations.

> [@angus](#):
>
> The redirect link is determined by your `discourse connect url` site setting on `community.abc.com` which I’m guessing is still set to `abc.com`.

Is there a way to dynamically set `discourse connect url` based on the **site url** used to login to WP?

Thanks.

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [December 11, 2024, 4:55pm UTC](https://meta.discourse.org/t/discourse-wordpress-plugin-does-not-auto-login-user-on-alias-domain/341744/4 "2024-12-11T16:55:00Z")

</div>

> [@Himanshu\_Singh](#):
>
> Is there a way to dynamically set `discourse connect url` based on the **site url** used to login to WP?

You’d need to build a Discourse plugin to do this.
