new-user-approve
new-user-approve copied to clipboard
Redirect to thank you page
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
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.
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 );