• Resolved ruralinfo

    (@ruralinfo)


    I am using the shortcode to hide the add form unless logged in, which results in a login or register alert. I am using a custom login and registration page where I would like to redirect users to. Is there any way to change the links to redirect them to my custom pages? Thank you

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi, you can modify the register and login urls using register_url and login_url filters, the code below will do that, you can add it in your theme functions.php file, and in the code update the links with your actual login and registration links.

    
    add_filter( 'register_url', 'my_register_url' );
    function my_register_url( $url ) {
        if( is_admin() ) {
            return $url;
        }
        return "https://www.postalrhd.com/register-url/";
    }
    add_filter( 'login_url', 'my_login_url', 10, 2 );
    function my_login_url( $url, $redirect = null ) {
        if( is_admin() ) {
            return $url;
        }
        $r = "";
        if( $redirect ) {
            $r = "?redirect_to=".esc_attr($redirect);
        }
        return "https://www.postalrhd.com/login-url/".$r;
    }
    
    Thread Starter ruralinfo

    (@ruralinfo)

    Thank you Greg.. You are so helpful with all questions. I really appreciate it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change login and register links’ is closed to new replies.