login_url filter creates permanent wp-admin -> wp-login redirection loop
Question
I have created a custom login page on my site and used the login_url filter to redirect to that page each time there’s a request. The filter looks like:
// Login page
function my_login_page($login_url, $redirect, $force_reauth) {
// This will append /custom-login/ to you main site URL as configured in general settings (ie https://domain.com/custom-login/)
$login_url = site_url( '/acceder/', 'login' );
if ( ! empty( $redirect ) ) {
$login_url = add_query_arg( 'redirect_to', urlencode( $redirect ), $login_url );
}
if ( $force_reauth ) {
$login_url = add_query_arg( 'reauth', '1', $login_url );
}
return $login_url;
}
add_filter('login_url', 'my_login_page', 10, 3);
The problem is that since then everytime I login with my account and try to access the dashboard I can’t. Whether I am logged-in or not logged-in I get to my custom login page.
Is there a way to solve this problem? So far I tried:
- Remove .htaccess and restore it.
- Flush wp rewrite rules.
- Deactivate all plugins.
- Remove all functions that may create a redirection loop and
activate one by one until I found it.
0
filters, login
3 years
2019-10-29T13:08:24-05:00
2019-10-29T13:08:24-05:00 0 Answers
86 views
0
Leave an answer