• Resolved Chris Gresham-Britt

    (@chrisgresh)


    Firstly, thanks for an incredible plugin.

    I’ve encountered a weird issue with a specific redirect:

    https://example.com/dashboard

    …automatically redirects to the WP Login screen. This seems to be consistent across my various WP installs, so I am guessing is a ‘helpful’ default. Unfortunately I need to redirect that path to a subdomain, e.g. https://dashboard.example.com.

    The redirect works when I’m logged in, but not when I’m logged out.

    As a workaround I’ve created a page with the slug /dashboard and that’s got it working for now.

    But I’m wondering if there’s a way to take priority over these default redirects? I can’t find the answer anywhere on Google.

Viewing 6 replies - 1 through 6 (of 6 total)
  • This is happening to me on a site with only WooCommerce, and no Redirection, so I’m thinking this is being done by WordPress.

    Plugin Author John Godley

    (@johnny5)

    Without knowing what is causing the redirect it’s hard to say. Redirection does generally operate at a high priority, but it is always possible that this can be overridden by something else, or something may operate at an even higher priority.

    In this case it sounds like WordPress is trying to log you in and it may be worth looking into why that is happening for a non-admin URL.

    Thread Starter Chris Gresham-Britt

    (@chrisgresh)

    Ahhhhhhhhhhh @galbaras I’m amazed I didn’t manage to turn that up while Googling. @galbaras @johnny5 any chance of some help writing a function to overturn this default behaviour for the /dashboard redirect specifically?

    Also, wondering whether the ability to view and overwrite these default redirects might be a handy feature for a future release?

    Never tested, but the function should be removed by

    remove_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 );

    You can then add your own action using a modified version of wp_redirect_admin_locations().

    @johnny5 You can, of course, do the same in the plugin, perhaps only to make filters available on the various defaults used in it.

    Of course, the best thing would be to start a Trac ticket asking for a core filter, which is surprisingly missing.

    • This reply was modified 2 years, 1 month ago by Gal Baras.
    Thread Starter Chris Gresham-Britt

    (@chrisgresh)

    @galbaras Thanks heaps for that. Agree that there should be a native way to modify this behaviour without removing and redefining the function!

    Really appreciate your input into this issue.

    @johnny5 happy to mark this as solved from my perspective. Keep up the good work ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘/dashboard redirects to WP Login page’ is closed to new replies.