Redirect Logged Users with WP Ghost
If you are using the WP Ghost plugin, you can use the built-in option to redirect logged users to the admin dashboard. Here is how you can do it:

- Go to WP Ghost > Tweaks > Redirects.
- Switch on the Redirects Logged Users To Dashboard option to automatically redirect users to the WordPress dashboard when they are logged in.
Once you have activated the option, any logged-in user accessing the custom login path will be automatically redirected to the admin dashboard.
Redirect Logged Users with Code
Alternatively, you can use a hook code if you use a custom login path for your WordPress website and want to automatically redirect logged-in users to the admin dashboard.
Here is how you can do it:
add_action('hmwp_login_init',function(){
global $current_user;
if (isset($current_user->ID)){
wp_redirect(admin_url());
exit;
}
});
Save the changes and upload the file to your server.
Once you have added the hook code, any logged-in user accessing the custom login path will be automatically redirected to the admin dashboard or the path you set in the code. This can be a helpful feature for your users and save them time and effort.
That’s it! You have now learned to redirect logged users to the admin dashboard using a custom login path on your WordPress website.