Title: Conditional redirection after registration
Last modified: October 19, 2021

---

# Conditional redirection after registration

 *  Resolved [ericbourges](https://wordpress.org/support/users/ericbourges/)
 * (@ericbourges)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/conditional-redirection-after-registration/)
 * Hi!
    I am using the user_registration_login_redirect hook to redirect the user
   based on the current page, it works fine and I would like to do this for registration
   as well. Is there a snipet to define the redirect url after user registration?
   Thanks in advance Eric

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [Sandip Pokhrel](https://wordpress.org/support/users/sandippokharel/)
 * (@sandippokharel)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/conditional-redirection-after-registration/#post-14986957)
 * Hi [@ericbourges](https://wordpress.org/support/users/ericbourges/)
 * Thanks for writing in,
 * Do you want to redirect the users to a certain page after registration?
    Please
   describe your requirement in detail?
 * Regards!
    WPEverest Support Team.
 *  Thread Starter [ericbourges](https://wordpress.org/support/users/ericbourges/)
 * (@ericbourges)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/conditional-redirection-after-registration/#post-14987318)
 * Hi Sandip,
    Thanks for the quick response
 * I have 2 options:
    – On the page with the registration form, I would like the
   user to be redirected after registering on another page (for example their account
   page). – On all the other pages, the registration form opens in a pop-up window
   and in this case I would like the user to stay on the page (typically to do an
   action requiring to be registered) I hope I was clear, thank you for your help
   Eric
 *  [Sandip Pokhrel](https://wordpress.org/support/users/sandippokharel/)
 * (@sandippokharel)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/conditional-redirection-after-registration/#post-14987770)
 * Hi [@ericbourges](https://wordpress.org/support/users/ericbourges/)
 * Thanks for writing back,
 * In order to redirect the user’s to another page after registration, you can go
   to the form’s settings and in General Settings you can find the option to insert
   the Redirection URL after registration.
    Could you please provide me the URL 
   of the page where the registration form popups? I will check on this matter and
   get back to you.
 * Regards!
 *  Thread Starter [ericbourges](https://wordpress.org/support/users/ericbourges/)
 * (@ericbourges)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/conditional-redirection-after-registration/#post-14987985)
 * Yes, I know that we can define the redirect page in the settings.
    The popup 
   window with the form can be opened from multiple pages, what I would like is 
   to be able to define a redirect after registration but only for the registration
   page (of which I know the ID and url)
 * In another thread in this support, I saw that you offered an add_action on user_registration_before_registration_form
   and an add_filter on user_registration_redirect_from_registration_page.
    Maybe
   it could be useful for me?
 * Regards
    Eric
 *  [Sandip Pokhrel](https://wordpress.org/support/users/sandippokharel/)
 * (@sandippokharel)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/conditional-redirection-after-registration/#post-14990867)
 * Hi [@ericbourges](https://wordpress.org/support/users/ericbourges/)
 * Thanks for writing back,
 * Hook for redirection after registration:
    `apply_filters( 'user_registration_redirect_from_registration_page',
   $redirect_url, $current_user );` I hope this helps.
 * Regards!
 *  Thread Starter [ericbourges](https://wordpress.org/support/users/ericbourges/)
 * (@ericbourges)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/conditional-redirection-after-registration/#post-14991305)
 * Thanks to you!
    Can you just explain to me quickly how to use it?
 *  [Sandip Pokhrel](https://wordpress.org/support/users/sandippokharel/)
 * (@sandippokharel)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/conditional-redirection-after-registration/#post-14994632)
 * Hi [@ericbourges](https://wordpress.org/support/users/ericbourges/)
 * Thanks for writing back,
 * If you want the users to stay in same page after registration, please use the
   following code.
 *     ```
       add_action( 'user_registration_before_registration_form', 'ur_set_register_redirect_url' );
       function ur_set_register_redirect_url( $form_id ) {
       	if ( isset( $_SERVER['HTTP_REFERER'] ) ) {
       		set_transient( 'originalLoginRefererURL', $_SERVER['HTTP_REFERER'], 60 * 60 * 24 );
       	}
       }
       add_filter( 'user_registration_redirect_from_registration_page', 'ur_register_redirect_back', 10, 2 );
       function ur_register_redirect_back( $redirect, $user ) {
       	if ( true === ( $redirect_url = get_transient( 'originalLoginRefererURL' ) ) ) {
       		delete_transient( 'originalLoginRefererURL' );
       		error_log( print_r( $redirect_url, true ) );
       		return $redirect_url;
       	}
       	return $redirect_url;
       }
       ```
   
 * Regards!
 *  [Sandip Pokhrel](https://wordpress.org/support/users/sandippokharel/)
 * (@sandippokharel)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/conditional-redirection-after-registration/#post-15053522)
 * Hi [@ericbourges](https://wordpress.org/support/users/ericbourges/)
 * Since you haven’t written us back for few days/weeks, you are going to mark this
   ticket as resolved.
    Please let us know if you have any questions.
 * Regards!

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Conditional redirection after registration’ is closed to new replies.

 * ![](https://ps.w.org/user-registration/assets/icon-256x256.gif?rev=3284028)
 * [User Registration & Membership - Free & Paid Memberships, Subscriptions, Content Restriction, User Profile, Custom User Registration & Login Builder](https://wordpress.org/plugins/user-registration/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/user-registration/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/user-registration/)
 * [Active Topics](https://wordpress.org/support/plugin/user-registration/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/user-registration/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/user-registration/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [Sandip Pokhrel](https://wordpress.org/support/users/sandippokharel/)
 * Last activity: [4 years, 7 months ago](https://wordpress.org/support/topic/conditional-redirection-after-registration/#post-15053522)
 * Status: resolved