• Resolved haroon1997

    (@haroon1997)


    Hi, I want login button to redirect me to the link that a have posted with this topic. I have read the documentation but it only helps us change our registration page and redirect us to custom page after successful login but there is no filter defined for changing default login page. Kindly help me in this regard. Thanks

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi @haroon1997 ,

    Thank you for writing in.

    You can set the redirect to the register page with login_logout_menu_register filter.
    You can find the filter in this documentation as well.

    Thread Starter haroon1997

    (@haroon1997)

    i want to redirect to custom login page not to the register page

    Hi @haroon1997,

    You can use the login_logout_menu_login filter to that.
    Here is a snippet of code,

    /**
    * Filter to redirect a user to a specific page after login.
    *
    * @return [URL] login URL with page slug on which it will be redirected after login
    */
    add_filter( 'login_logout_menu_login', 'loginpress_login_menu_login_redirect_cb' );
    function loginpress_login_menu_login_redirect_cb() {
       return wp_login_url( '/hello-world' );
    }

    We have other filters to help with other redirects as well.
    You can find these filters in this documentation as well.

    Hi @wpzainab
    I think that @haroon1997 wants redirect to custom login page (before login) and your code is redirecting after login. I also looking for such solution to allow user to login from custom(different) login page than the default.

    Plugin Support Muhammad Arslan

    (@wparslan)

    Hi @jax2000 ,
    You can use this filter login_logout_menu_login to redirect the user to the custom login page.

    here is a code snippet that can be used to achieve your desired functionality.

    /**
    * Filter to redirect a user to a specific page after login.
    *
    * @return URL login URL with page slug on which it will be redirected after login
    */
    add_filter( 'login_logout_menu_login', 'loginpress_login_menu_login_redirect_cb' );
    function loginpress_login_menu_login_redirect_cb() {
       return site_url() . '/custom-login';
    }

    Hi @wparslan and @wpzainab

    The filter (login_logout_menu_login) that you are suggesting is working only to redirect a user to a specific page AFTER login. You can see it also in the comment before the block of code that you have posted (Filter to redirect a user to a specific page after login).
    The question is if is possible when pressing Login button to redirect a user to a specific page BEFORE login. It is needed to redirect the user for example not in “../wp-login.php” page but in “../my-account” page.
    Thanks

    • This reply was modified 3 years, 5 months ago by Thraser.

    Hi @thraser,

    Thank you for writing to us. Though you are requested to make a new ticket for your concern so it can be answered exclusively. It will be helpful for the users and the team itself to maintain its individuality.

    Looking forward!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Redirect to Woocommerce login page’ is closed to new replies.