If you are using the login shortcode along with the redirect_url parameter like [user_registration_login redirect_url=”/”] in widgets or on pages with page builders, login redirect might not work. You need to manually add the following codes to your child theme’s functions.php
add_filter( 'user_registration_login_redirect', 'ur_redirect_after_login', 10, 2 ); function ur_redirect_after_login( $redirect, $user ) { return home_url(); }
If you want to redirect to any other page, replace the home_url() with ‘page-slug’. Check the code below.
add_filter( 'user_registration_login_redirect', 'ur_redirect_after_login', 10, 2 ); function ur_redirect_after_login( $redirect, $user ) { return 'sample-page'; }
The above codes will redirect the users to sample page after they login
Check How to add custom code snippet?