# After login it redirects to WP. can it return users back where they came from?

**URL:** <https://meta.discourse.org/t/after-login-it-redirects-to-wp-can-it-return-users-back-where-they-came-from/67061>\
**Category:** WordPress\
**Created:** [2017 年7 月 29 日 11:16 UTC](https://meta.discourse.org/t/after-login-it-redirects-to-wp-can-it-return-users-back-where-they-came-from/67061 "2017-07-29T11:16:26Z")\
**Posts on this page:** 4\
**Page:** 1

## AI-generated summary

Andy02 is experiencing issues with users logging into their forum being redirected to WordPress instead of returning to their original destination. [Andy02](/t/-/67061/1) wants to know if it's possible to change this behavior so users are returned to either the forum or WordPress depending on where they clicked the login link. [simon](/t/-/67061/2) confirms that this is the expected behavior and offers to help troubleshoot the issue. 

After testing, [simon](/t/-/67061/4) finds that the redirect works correctly when logging in from the forum, but not when logging in from an external link. He suggests that the issue may be related to the multisite WordPress setup and recommends enabling the 'Multisite Configuration' option to give all subsites access to the same Discourse forum.

<div class="post-metadata">

**Author:** ![Andy02](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/andy02/32/119498_2.png) [@Andy02](https://meta.discourse.org/u/Andy02)\
**Post date:** [2017 年7 月 29 日 11:16 UTC](https://meta.discourse.org/t/after-login-it-redirects-to-wp-can-it-return-users-back-where-they-came-from/67061/1 "2017-07-29T11:16:26Z")

</div>

users logging in on my forum get lost and confused as they login then get sent to the wordpress. new users think that is where the link they 1st clicked takes them to.

can i change this so users login and then get returned to the forum if they came from there, or wordpress if they clicked login there?

thanks

---

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [2017 年7 月 29 日 16:23 UTC](https://meta.discourse.org/t/after-login-it-redirects-to-wp-can-it-return-users-back-where-they-came-from/67061/2 "2017-07-29T16:23:35Z")

</div>

> [@Andy02](#):
>
> can i change this so users login and then get returned to the forum if they came from there, or wordpress if they clicked login there?

Yes, that is how it is supposed to work. Can I create an account on your forum so that I can see what’s going on?

---

<div class="post-metadata">

**Author:** ![Andy02](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/andy02/32/119498_2.png) [@Andy02](https://meta.discourse.org/u/Andy02)\
**Post date:** [2017 年7 月 30 日 16:15 UTC](https://meta.discourse.org/t/after-login-it-redirects-to-wp-can-it-return-users-back-where-they-came-from/67061/3 "2017-07-30T16:15:50Z")

</div>

sure. i’ve set it to return users to the forum now, but that is confusing to users who click login at our wordpress site as they end up somewhere they didn’t want, or expect to be

its: [discuss.focallocal.org](http://discuss.focallocal.org)

and the wordpress: [news.focallocal.org](http://news.focallocal.org)

to not confuse users we’d need a command to return them back where they clicked login from

---

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [2017 年7 月 30 日 17:00 UTC](https://meta.discourse.org/t/after-login-it-redirects-to-wp-can-it-return-users-back-where-they-came-from/67061/4 "2017-07-30T17:00:34Z")

</div>

> [@Andy02](#):
>
> i’ve set it to return users to the forum now

I’ve tried it. When I am logged into WordPress and not logged into the forum, clicking the login link on the forum is working correctly - my credentials are checked on WordPress and I’m automatically redirected back to Discourse as a logged in user. When I am not logged into either Discourse or WordPress and click the Discourse login link, I’m redirected to WordPress and am able to complete the login process, but I’m not automatically redirected back to the forum. There are a couple of things that could be causing this problem.

> [@Andy02](#):
>
> is confusing to users who click login at our wordpress site as they end up somewhere they didn’t want, or expect to be

I’m not sure what’s going on here. It seems to be working correctly for me. The [WP Discourse](https://github.com/discourse/wp-discourse) plugin should not be having any effect on the WordPress login process when a user clicks on a login link from inside of WordPress. If it is, there’s a problem.

I see you have a multisite WordPress setup. It’s possible that some of the trouble you’re having is related to this. Do you have access to the network settings? Do you know if the Network ‘Multisite Configuration’ option has been enabled? It’s purpose is to give all subsites on a network access to the same Discourse forum. It seems like it could be useful for your case. If you have any trouble setting this up, get in touch with me and I can try to help.
