I'm stuck in a WordPress redirect loop which happened after hooking into the wp_login
action. The strange thing is that I've already removed the piece of code in question, cleared cookies and restarted computer and servers - but the problem remains.
They started immediately after I added this piece of code:
function check_login_redirect() {
if( isset($_GET['redirect_to']) ) wp_redirect( esc_url($_GET['redirect_to']) );
}
add_action('wp_login', __NAMESPACE__.'\\check_login_redirect');
(I've since realised that there should have been an exit
after wp_redirect
.)
I hadn't recently installed any plugins or touched .htaccess files.
Initially I did have access to the admin panel, but after logging out and clearing cookies all URLs just send me into a redirect loop with these two alternating responses:
Status Code:301 Moved Permanently
Remote Address:[::1]:8080
Status Code:302 Found
Remote Address:[::1]:8080
I'm not using HTTPS.
Is there any way the code I removed could still linger? What's the best way of diagnosing the problem without access to the admin panel?
Fingers crossed this is something simple, but stuck on how to diagnose this.
Thanks!
Simon
WordPress 4.7.2, PHP 7