halben Posted October 21, 2013 Share Posted October 21, 2013 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? Quote Link to comment https://forums.phpfreaks.com/topic/283162-throwing-redirect-error-instead-of-redirecting-to-page-template-login/ Share on other sites More sharing options...
Ch0cu3r Posted October 21, 2013 Share Posted October 21, 2013 Somewhere else is also redirecting the request multiple times. Your browser is then stopping the request. Quote Link to comment https://forums.phpfreaks.com/topic/283162-throwing-redirect-error-instead-of-redirecting-to-page-template-login/#findComment-1454828 Share on other sites More sharing options...
AbraCadaver Posted October 21, 2013 Share Posted October 21, 2013 I don't know nor like WP, but It looks like, if you are landing on the login page that you get redirected to the login page. Kind of an endless loop. Quote Link to comment https://forums.phpfreaks.com/topic/283162-throwing-redirect-error-instead-of-redirecting-to-page-template-login/#findComment-1454829 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.