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:
Once you have activated the option, any logged-in user accessing the custom login path will be automatically redirected to the admin dashboard.
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.
Because hackers often use bots to search for security flaws in your website, it is…
The easiest way to change the default media uploads path is to use the WP…
To hide all CSS and JS you need to follow the steps to Combine the…
https://youtu.be/6ylhojSi-_E In this video, we’ll explore why website security matters and what can happen if…
The security of your WordPress site depends on multiple factors, such as the strength of…
When you enable two-factor authentication (2FA) for your WordPress website, it adds an extra layer…