User Registration

  1. Home
  2. Docs
  3. User Registration
  4. How to?
  5. How to change redirect URL after login?

How to change redirect URL after login?

To redirect users to a specific page after login, you can simply add the redirect URL parameter in login form Shortcode.

The redirect_url parameter allows you to redirect to a certain page after the user is logged in. E.g. [user_registration_my_account redirect_url="sample-page"] will redirect to the sample page after logging in.
Note: Don’t forget to replace the “sample-page” with the slug of the page where you want to redirect.

There are chances that the above-mentioned method might not work in some cases. In such cases, please copy and paste this code on your active theme’s functions.php file and it will do the trick.
Here is the code:
add_filter( ‘user_registration_login_redirect’, ‘ur_redirect_after_login’, 10, 2 );
function ur_redirect_after_login( $redirect, $user ) {
return ‘sample-page’ ;
}

Was this article helpful to you? Yes 6 No 26

How can we help?