new-user-approve icon indicating copy to clipboard operation
new-user-approve copied to clipboard

Redirect to thank you page

Open picklewagon opened this issue 10 years ago • 2 comments

When we register new users on this plugin redirects to wp-login page But i have to redirect them to my Thank page Means my own page.I have tried wp-redirect() .header('Location:mypage') and also java-script window.location but i didn't work for this plugin.This all i have done just after when users get register and its status is pending.

Issue #15

picklewagon avatar Jan 13 '15 07:01 picklewagon

I am looking to track registrations either by sending an JS-event for GTM / GA or by forwarding them to a special side. Checking the code I found:

public function show_user_pending_message( $errors ) {
                if ( !empty( $_POST['redirect_to'] ) ) {
                        // if a redirect_to is set, honor it
                        wp_safe_redirect( $_POST['redirect_to'] );
                        exit();
                }

Would this wp_safe_redirect work by putting the following function in functions.php?

function wpse_19692_registration_redirect() {
    return home_url( '/my-page' );
}

add_filter( 'registration_redirect', 'wpse_19692_registration_redirect' );

Edit: Tried the function and what happens is that the confirmation message is not shown. Instead I am redirected to the login page.

mikeg-de avatar Jan 10 '17 14:01 mikeg-de

Add this code snippet in the theme’s function.php:

function updefy_registration_redirect( $user_id ) {
    wp_safe_redirect( home_url('/your-page-slug/'));
    exit;
}

add_action( 'user_register', 'updefy_registration_redirect', 10, 1 );

updefy avatar Dec 27 '23 22:12 updefy