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.
add_filter( 'user_registration_login_redirect', 'ur_redirect_after_login', 10, 2 ); function ur_redirect_after_login( $redirect, $user ) { return 'sample-page' ; }
Having trouble with adding custom codes to your site? Check this.