I'm trying to create a custom login page for a custom user page, but I can't get wordpress to stop redirecting the word login to wp-login.php.
Setup is pretty simple, I'm adding a rule that looks like this. account/login/?$
that yields to index.php?account=login
. I also setup my rewrite tag for that custom query var. I have a couple other rules setup and they all work properly.
When I use monkey man's rewrite analyzer everything points properly, but on the front end any time I enter login
into the url it redirects me to wp-login.php. It doesn't matter what segment it is entered at. so /login
, /account/login
, /dogs/bulldogs/login
.... all redirect to wp-login.php
As far as I can tell there aren't any other rewrite rules containing login
. So i'm at a loss.
As a last piece of info, i'm working in wp 3.6
Any advise or ideas would be greatly appreciated.
Building on top of Diogos great answer, you can even disable the /login redirect without losing the other redirects. I just posted this solution on WPSE: Disable "/login" redirect
I'm facing the exact same problem. Google wasn't being very helpful, so I had the need to dig in. :)
Right on top of the wp-includes/template-loader.php file, you find this little snippet of code:
If you inspect what functions are hooked to that action at that time, you'll find a reference to the wp_redirect_admin_locations function (both the hook and the function are declared on the /wp-includes/canonical.php file - line 526).
Within the wp_redirect_admin_locations function, you'll find this:
An easy solution for the problem, would be to hook a function of yours to the *wp_redirect* filter. Something like this (within your functions.php):So... The *wp_redirect_admin_locations* terminates the script after trying to preform the redirect, so the solution above won't work.
The only other solution I'm seeing right now is to bypass the function all together which kind of sucks. All the other redirects defined within that function, will be lost all together...
Anyway, what I've ended up using: