I am using Theme My Login plugin to change the login page from "/wp-login.php" to "/login".
My question is how do I redirect a user that has already logged in so that visiting "/login" instead takes them to my homepage?
Note: I am not talking about the initial redirect after logging in, but rather if someone was to visit the login page again afterwards.
I saw a similar question was asked here: wp-login.php — redirect logged in users to custom URL
I tried using the code posted there, and changed it to:
function redirect_logged_in_user()
{
if( is_user_logged_in ) {
wp_redirect('http://my_homepage_url');
}
}
global $pagenow;
if( $pagenow == '/login')
redirect_logged_in_user();
but it still does not work.
any help would be much appreciated.
cheers.