I am having trouble in getting the url of the page from where I click the register link.


The url of the login page is:


And I when I click register link it should add the redirect_to link in the register page like this:


I have used the following code but its not taking redirect_to parameter:

add_action( 'registration_redirect', 'redirection_link' );
function redirection_link( $redirect_to ) {

1 Answer 1


You are definitely on the right track; just add a filter (not action!) to your functions.php and pass in the redirect_to parameter (no need for wp_redirect). As soon as the user has submitted the registration form, there will be a redirect to the new page:

add_filter( 'registration_redirect', 'redirection_link' );
function redirection_link( $redirect_to ) {
    return $redirect_to . 'xtreme/page=1406';

Update: To perform a hard/permanent redirect to another page you can go with an wp_redirect like this:

add_filter( 'registration_redirect', 'redirection_link' );
function redirection_link( ) {
    wp_redirect( 'http://abcd.com/xtreme/page=1406', 301 );
    // wp_redirect( home_url( '/xtreme/page=1406' ), 301 );

Update 2: You can also pass in additional parameters (e.g. redirect_to) if you modify the default register_url:

add_filter( 'register_url', 'custom_register_url' );
function custom_register_url( $register_url ) {
    $register_url = home_url( '/wp-login.php/?action=register&redirect_to=http://abcd.com/xtreme/page=1406' );
    return $register_url;

Update 3: You can update/reset the registration_redirect to your new register_url (from Update 2) like this:

add_filter( 'registration_redirect', 'reset_redirection_link' );
function reset_redirection_link() {
    return wp_registration_url();
  • Thanks for answering but i don't want the link to appear after the user has registered.I want it to appear on the action=register or registration page....when the register link is clicked on the login page. Dec 18, 2013 at 5:09
  • @ParthKumar Okay, sorry, I've updated my answer with the fix! I think this will do the trick :)
    – Sven
    Dec 18, 2013 at 6:24
  • Thanks for replying back but i have already tried this.The url changes what i wanted ...but results in an error saying too many redirects Dec 18, 2013 at 6:47
  • Try to redirect to home_url( '/' ) first to validate that it is working at all; are you redirecting your page=1406, too (e.g. via .htaccess)?
    – Sven
    Dec 18, 2013 at 8:03
  • Its working perfectly fine for the home_url('/') as well as for abcd.com/wp-login.php but not working for anything given as 'abcd.com/wp-login.php?*'...ie after the ? mark it is displaying same error ...too many redirects. And i am not doing anything in htaccess Dec 18, 2013 at 8:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.