1

After lot of search and work i didn't find anything to help me like i wanted now i want to change URL of my wordpress register page and login page. I'm doing to add sample here which you will see how i want login page and how wordpress is trying to show me.

enter image description here

But wordpress automatically redirect my to another boring page which i also customize but i want this to my page. I'm doing to show you that where wordpress take when i click on (Register or Login) url.

Here is below,

enter image description here

1

Just customize the login URL with the login_url filter:

https://gist.github.com/tripflex/ac477b59d20bd11c5856edcffc13e5ef

add_filter( 'login_url', 'smyles_custom_login_url', 10, 3 );
/**
 * Filters the login URL.
 *
 * @since 2.8.0
 * @since 4.2.0 The `$force_reauth` parameter was added.
 *
 * @param string $login_url    The login URL. Not HTML-encoded.
 * @param string $redirect     The path to redirect to on login, if supplied.
 * @param bool   $force_reauth Whether to force reauthorization, even if a cookie is present.
 *
 * @return string
 */
function smyles_custom_login_url( $login_url, $redirect, $force_reauth ){
    // This will append /custom-login/ to you main site URL as configured in general settings (ie https://domain.com/custom-login/)
    $login_url = site_url( '/custom-login/', 'login' );
    if ( ! empty( $redirect ) ) {
        $login_url = add_query_arg( 'redirect_to', urlencode( $redirect ), $login_url );
    }
    if ( $force_reauth ) {
        $login_url = add_query_arg( 'reauth', '1', $login_url );
    }
    return $login_url;
}

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.