# Redirect to Discourse page after logging in to Wordpress as SSO Provider (via WooCommerce)

**URL:** <https://meta.discourse.org/t/redirect-to-discourse-page-after-logging-in-to-wordpress-as-sso-provider-via-woocommerce/138375>\
**Category:** WordPress\
**Created:** [January 12, 2020, 9:17am UTC](https://meta.discourse.org/t/redirect-to-discourse-page-after-logging-in-to-wordpress-as-sso-provider-via-woocommerce/138375 "2020-01-12T09:17:24Z")\
**Posts on this page:** 3\
**Page:** 1

## AI-generated summary

[jord8on](/t/-/138375/1) is seeking help with redirecting users to the Discourse page after logging in to Wordpress as the SSO Provider via WooCommerce. Currently, when a user logs in to Wordpress, they are redirected to the Wordpress `/my-account` page, but when attempting to log in from Discourse, they are not redirected back to Discourse. The user has tried various solutions and is looking for a custom code to resolve the issue. [knandi](/t/-/138375/2) has asked if a solution has been found, while [pfaffman](/t/-/138375/3) has suggested that custom code is usually required for WooCommerce integration and recommended exploring the subscriptions plugin.

<div class="post-metadata">

**Author:** ![jord8on](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jord8on/32/166809_2.png) [@jord8on](https://meta.discourse.org/u/jord8on)\
**Post date:** [January 12, 2020, 9:17am UTC](https://meta.discourse.org/t/redirect-to-discourse-page-after-logging-in-to-wordpress-as-sso-provider-via-woocommerce/138375/1 "2020-01-12T09:17:24Z")

</div>

Continuing a discussion with @simon from: [Get Discourse to recognize accounts verified in Wordpress (and WooCommerce) for SSO](https://meta.discourse.org/t/get-discourse-to-recognize-accounts-verified-in-wordpress-and-woocommerce-for-sso/137535/5):

> [@Get Discourse to recognize accounts verified in Wordpress (and WooCommerce) for SSO](https://meta.discourse.org/t/get-discourse-to-recognize-accounts-verified-in-wordpress-and-woocommerce-for-sso/137535/5):
>
> The expected bahaviour is that when a user who isn’t logged into WordPress clicks either the login button on Discourse, or an SSO login link that’s been generated below a post that’s been published to Discourse, the user will be taken through the WordPress login process and then redirected to the correct Discourse URL. Let me know if this isn’t working correctly for users who have verified their email address.

Here’s some info about our setup:

- We are using the [WP Discourse](https://github.com/discourse/wp-discourse) plugin for my Wordpress site
- We are using Wordpress as the SSO Provider
- We DO NOT use the default `wp-login.php` for users to login or register
- We DO NOT use a dedicated membership plugin, like Memberful
- We DO use WooCommerce as our login provider, which also manages users and provisions new users in Wordpress, after new accounts are created
- WooCommerce uses /my-account for Registration/Login (e.g. [https://pickleballist.com/my-account](https://pickleballist.com/my-account))
- Using the tip provided in the link above - when a _Verified WP User_, who is logged in to WP, clicks the “Login” button on Discourse, they are automatically logged in to Discourse 👍

The challenge we are facing is that users are never redirected to Discourse. Here’s what we’d like to see:

User is on Wordpress: If a user clicks Register/Login, we would want them to see the WP login/reg modal, use it, and after logging in, be redirected to the Wordpress /my-account page. This is what currently is happening.

User is on Discourse: If a user clicks the “Login” or a “Reply” button on one of the threads, we would want them to see the WP login/reg modal, use it, and after logging in, be redirected back to the place where they left Discourse.

I’ve reviewed some other threads but can’t seem to find a solution that works for us. Any help would be greatly appreciated!

- [Possible bug with 'Redirect After Discourse Login' field](https://meta.discourse.org/t/possible-bug-with-redirect-after-discourse-login-field/62883)
- [Problem redirecting to forum after login when using MemberMouse](https://meta.discourse.org/t/problem-redirecting-to-forum-after-login-when-using-membermouse/77871/)

---

<div class="post-metadata">

**Author:** ![knandi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/knandi/32/202226_2.png) [@knandi](https://meta.discourse.org/u/knandi)\
**Post date:** [November 4, 2020, 10:39am UTC](https://meta.discourse.org/t/redirect-to-discourse-page-after-logging-in-to-wordpress-as-sso-provider-via-woocommerce/138375/2 "2020-11-04T10:39:21Z")

</div>

Have you found a solution? I would be glad

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [November 4, 2020, 12:13pm UTC](https://meta.discourse.org/t/redirect-to-discourse-page-after-logging-in-to-wordpress-as-sso-provider-via-woocommerce/138375/3 "2020-11-04T12:13:42Z")

</div>

If you want to charge for access to discourse, I’d recommend the new subscriptions plugin.

There see other topics about getting woocommerce. It usually requires some custom code.
