Redirect Logged Users to Admin Dashboard
October 28, 2021
To redirect the logged users to admin when accessing the custom login path you can use the following hook code:
add_action('hmwp_login_init',function(){ global $current_user; if (isset($current_user->ID)){ wp_redirect(admin_url()); exit; } });
Add the code at the end of the wp-config.php file or in the theme’s functions.php file.
Result! Once you access the custom login path, if you are already logged in, the page will redirect to the admin dashboard.
Update: Since Hide My WP Ghost ver. 6.0.20 you can do this by activating the option Redirect Logged Users to Dashboard
