WordPress.org

Forums

wp-admin won't work after changing wp-login url (1 post)

  1. supraicer69
    Member
    Posted 2 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic