Jump to content

Throwing redirect error instead of redirecting to page template: /login


halben

Recommended Posts

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.