Ultimate Member is a WordPress profile and membership plugin which has been active in more than 80k sites.
It's a free plugin but it's possible to extend the features by using (premium) extensions.
You can specify the redirection URL after registration or login under Ultimate Member > User Roles.
You can choose one from the following options for Action to be taken after login:
- Redirect to profile
- Redirect to URL
- Refresh active page
- Redirect to WordPress Admin
Among them, if you choose the Refresh active page option, users will be redirected to the Account page intead of previous page (or referring page) after login.
If you want to redirect users to the previous page (or current active page before login attempt), please add the following code to your theme's function file (i.e. functions.php). Of course, it's strongly recommended to create a child theme.
// Add Login and Logout menu items to menu whose menu name (theme_location) is 'primary' // Redirects to current page after login/logout add_filter( 'wp_nav_menu_items', 'wti_loginout_menu_link', 10, 2 ); function wti_loginout_menu_link( $items, $args ) { if ($args->theme_location == 'primary') { if (is_user_logged_in()) { $items .= '<li class="right"><a href="'. wp_logout_url( get_permalink() ) .'">Logout</a></li>'; // For logout } else { $items .= '<li class="right"><a href="'. wp_login_url(get_permalink()) .'">Login</a></li>'; // For login } } return $items; }
Please change the value of theme_location depending on your theme's navigation. It may be generally 'primary', 'main' or similar. For Avada, you may use "menu-main-nav."