I'm getting the error: Error code: ERR_TOO_MANY_REDIRECTS after writing this filter hook function into my child theme functions.php.
My code is below:
function redirect_wp_login() {
$request = basename($_SERVER['REQUEST_URI']);
if ($request == 'wp-login.php') {
wp_redirect(site_url('/login'));
exit();
}
}
add_filter('init', 'redirect_wp_login');
Anything wrong with the code?