Developers

Redirect Logged Users to Admin Dashboard

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:

  1. Go to WP Ghost > Tweaks > Redirects.
  2. Switch on the Redirects Logged Users To Dashboard option to automatically redirect users to the WordPress dashboard when they are logged in.
  3. Click the Save button to apply the changes

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.

John Darrel

Change the WordPress Database Prefix for Security

Replace the default wp_ database prefix with a random one to protect against SQL injection…

1 year

Customize WordPress Uploads Directory

The easiest way to change the default media uploads path is to use the WP…

1 year

WP Ghost and WP Rocket Cache

To hide all CSS and JS you need to follow the steps to Combine the…

1 year

Why is website security important?

https://youtu.be/6ylhojSi-_E In this video, we’ll explore why website security matters and what can happen if…

1 year

Is WordPress Website Easily Hacked?

The security of your WordPress site depends on multiple factors, such as the strength of…

1 year

Set Up WordPress 2FA with Mobile Authenticator Apps

Step-by-step guides to connect WP Ghost 2FA with Google Authenticator, Authy, Microsoft Authenticator, or LastPass.…

1 year