I changed the wp-login.php url to /login/ so all links in registration and forgot password emails have /login/ rather than wp-login.php.

The problem now is that when I visit /wp-admin/ or click on the dashboard once logged in, it starts by going to wp-login.php?redirect_to... and then goes to /login/.

How can I fix it to keep the custom login url but also access wp-admin?


add_filter('site_url',  'wplogin_filter', 10, 3);
function wplogin_filter( $url, $path, $orig_scheme )
 $old  = array( "/(wp-login\.php)/");
 $new  = array( "login");
 return preg_replace( $old, $new, $url, 1);

add_filter( 'lostpassword_url', 'custom_lostpass_url' );
function custom_lostpass_url( $lostpassword_url ) {
    return get_option('siteurl'). '/forgot-password/';
  • I should add that /login/ is a custom page template that has a custom login form. Is there certain functionality I need to add for wp-admin on that page? – Dave Feb 5 '13 at 11:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.