wp-admin won’t load after setting wp-login custom url

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/.

Read More

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

Functions.php

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/';
}

Related posts

Leave a Reply