You may have searched the whole internet for a function that allows you to change the default behavior of redirect successful user registration in WordPress to a custom page. One of the many reasons you would want to do this is to route users to a thank-you page when they successfully finish a registration.
By default, WordPress redirects any successful registration to example.com/wp-login.php?checkemail=registered.
If you would want to change this default behavior of WordPress, you are in the right place.
To redirect successful registration to another page in WordPress, you can use the “registration_redirect” hook in your functions.php file.
Simply add this code snippet to your functions.php file, and any successful user registrations will be automatically redirected to your specified page.
add_filter( 'registration_redirect', 'custom_registration_redirect' );
function custom_registration_redirect() {
return home_url( '/thankyou-page/' ); // replace with the URL of your specified page
}
If this post was useful, please leave a comment below.
You can also check other blogs (via this LINK) to learn more about WordPress and its features.