WP Ghost can automatically redirect logged-in users to the admin dashboard when they visit the custom login path. When you use a custom login URL with WP Ghost, logged-in users who visit that URL see the login form again instead of being redirected to the dashboard. The built-in redirect option fixes this by sending already-authenticated users straight to the dashboard. A code alternative is also available for custom redirect destinations.

Why Redirect Logged-In Users?

Why redirecting logged-in users to the dashboard improves UX with WP Ghost custom login paths

When WP Ghost hides the default login path and replaces it with a custom URL, logged-in users who bookmark or revisit that custom login URL see the login form even though they’re already authenticated. This is confusing and wastes time. Enabling the redirect sends these users directly to the dashboard, which is where they intended to go. This is especially useful for multi-user sites where editors and authors regularly access the admin area.

Method 1: Built-in WP Ghost Setting

  1. Go to WP Ghost > Tweaks > Redirects.
  2. Switch on Redirect Logged Users To Dashboard.
  3. Click Save.
WP Ghost Tweaks Redirects section showing the Redirect Logged Users To Dashboard toggle

Any logged-in user who visits the custom login path is now automatically redirected to the WordPress admin dashboard.

Method 2: Custom Code

If you need to redirect logged-in users to a specific URL instead of the dashboard (for example, a custom admin page, a membership area, or the homepage), use the hmwp_login_init hook. Add this code to your child theme’s functions.php file or a code snippets plugin:

add_action('hmwp_login_init', function() {
    if (is_user_logged_in()) {
        wp_redirect(admin_url());
        exit;
    }
});

To redirect to a different URL instead of the dashboard, replace admin_url() with your target. For example, home_url() for the homepage, admin_url('edit.php') for the Posts list, or any custom URL like 'https://yourdomain.com/members/'.

Use a child theme or code snippets plugin. Adding code to functions.php in the parent theme means your changes are lost when the theme updates. Use a child theme or a code snippets plugin to keep the filter persistent.

Frequently Asked Questions

Which method should I use?

Use Method 1 (built-in setting) if you want logged-in users redirected to the standard WordPress dashboard. Use Method 2 (code) if you need to redirect to a specific page, a membership area, or if you want different redirect destinations based on user role.

Can I redirect different roles to different pages?

Yes, with Method 2. Check the user’s role inside the hook and redirect accordingly. For example, redirect editors to admin_url('edit.php') and subscribers to home_url(). WP Ghost also has a built-in role-based redirect feature at WP Ghost > Tweaks > Redirects.

Does this work with WooCommerce?

Yes. You can redirect WooCommerce customers to the My Account page instead of the dashboard using wc_get_page_permalink('myaccount') in Method 2. The built-in Method 1 always redirects to the dashboard, which may not be ideal for customer-facing WooCommerce logins.

Does WP Ghost modify WordPress core files?

No. The redirect works through WordPress hooks (hmwp_login_init action or the built-in setting). No core files are modified.

Login path and redirect configuration: