2

I have this form in a page template

<form action="<?php echo site_url('wp-login.php?action=register', 'login_post') ?>" method="post">
    <div class="formrow requiredRow"><label id="FullName-ariaLabel" for="txt_FullName">Full Name</label>
    <input class="required" id="txt_FullName" title="Full Name. This is a required field" type="text" name="first_name" /></div>

    <div class="formrow requiredRow"><label id="FullName-ariaLabel" for="txt_FullName">Email</label>
    <input class="required" id="user_email" title="Full Name. This is a required field" type="text" name="user_email" /></div>          

    <div class="formrow requiredRow"><label id="Password-ariaLabel" for="pwd_Password">Password</label>
    <input class="required" id="pwd_Password" title="Password. This is a required field" type="password" name="user_pass" /></div>

    <div class="row">
    <input class="" id="user_login" type="hidden" name="user_login"/>
    <?php do_action('register_form'); ?>
    <input type="submit" value="Submit form" /></div>

</form>

I need to redirect to a custom page so I have tried this filter from the question below. After registering from my custom page, I am not being redirected to /my-page but I have been being redirected to http://www.example.com/wp-login.php?checkemail=registered with the message Registration complete. Please check your e-mail.

function __my_registration_redirect(){
    return home_url( '/my-page' );
}
add_filter( 'registration_redirect', '__my_registration_redirect' );

https://wordpress.stackexchange.com/a/19698/10413

How can I redirect to a custom URL when registrations are posting from a page with a custom template?

4 Answers 4

2

Instead of using home_url, header(location) you can use wp_redirect()

function __my_registration_redirect(){
    wp_redirect( '/my-page' );
    exit;
}
add_filter( 'registration_redirect', '__my_registration_redirect' );

This might be helpfull

0

You can use plugin for manage redirects after login/logout/register actions Peter's Login Redirect

-1

What you're looking for is header('Location: url_goes_here');

Try:

function __my_registration_redirect(){
    header("Location: /my-page");
}
-1

try this code:

function __my_registration_redirect(){
  $url=home_url( '/my-page' );
  header("Location: ". $url);
  exit;
 }
 add_filter( 'registration_redirect', '__my_registration_redirect' );

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.