Title: Login redirect using code snippet
Last modified: August 22, 2023

---

# Login redirect using code snippet

 *  [boqorwp](https://wordpress.org/support/users/boqorwp/)
 * (@boqorwp)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/login-redirect-using-code-snippet/)
 * Could anyone please help me out with a small code snippet I’m trying to put in
   place?
 * When someone logs in / registers on woocommerce by filling out the login/registration
   form id like to add the email parameter to the url they’re being redirected to?
   I’m new to WordPress and have hit a lot of brick walls when attempting to write
   a code snippet for this. Any help or suggestion would be very very much appreciated.
 * Use case:
 * 1: someone logs in / registers (and therefore provides their email address in
   the email address field as part of the login/registration flow)
 * 2: they are redirected to a url
 * 3: the email address is appending dynamically to whatever url they were redirected
   to
 * // example walk through:
 * 1: someone logs/registers with their email address of [goodexample@test.com](https://wordpress.org/support/topic/login-redirect-using-code-snippet/goodexample@test.com?output_format=md)
   on [woocommerces form handler](https://woocommerce.github.io/code-reference/files/woocommerce-includes-class-wc-form-handler.html#source-view.1116)
 * 2: they are redirected to [http://www.goodexample.com/my-account](http://www.goodexample.com/my-account)
 * 3: our code snippet ensures the url they are redirected to always has “?email
   =goodexample@test.com” appended to it at the end. In this case the email they
   provided was [goodexample@test.com](https://wordpress.org/support/topic/login-redirect-using-code-snippet/goodexample@test.com?output_format=md)
   and the url they were going to be redirected to without the code snippet was 
   [http://www.goodexample.com/my-account](http://www.goodexample.com/my-account).
   With our custom code snippet they URL they are redirected to in the end is actually
   [http://www.goodexample.com/my-account?email=goodexample@test.com](http://www.goodexample.com/my-account?email=goodexample@test.com)(
   code snippet needs to work for any email that is used to login / register and
   for all urls they might be redirected to
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Flogin-redirect-using-code-snippet%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/login-redirect-using-code-snippet/#post-16993652)
 * I recommend getting in touch with WooCommerce’s support about this via [https://woocommerce.com/my-account/create-a-ticket/](https://woocommerce.com/my-account/create-a-ticket/)
   if you have any of their paid WooCommerce products or [https://wordpress.org/support/plugin/woocommerce/](https://wordpress.org/support/plugin/woocommerce/)
   if you do not.

Viewing 1 replies (of 1 total)

The topic ‘Login redirect using code snippet’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 2 participants
 * Last reply from: [James Huff](https://wordpress.org/support/users/macmanx/)
 * Last activity: [2 years, 9 months ago](https://wordpress.org/support/topic/login-redirect-using-code-snippet/#post-16993652)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
