Redirect to home page after login into site

This topic has 9 replies, 2 voices, and was last updated 1 months, 4 weeks ago ago by Andrew Mitchell

  • Avatar: modestyestore
    modestyestore
    Participant
    October 31, 2024 at 14:29

    When some user login in to our site by social link or standard login functionality then it should be redirect to site home page.
    Right now it is directing to the account page.

    Please help me on above changes

    8 Answers
    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    October 31, 2024 at 16:05

    Hello, modestyestore,

    At the moment, the theme does not have this functionality. However, if you provide us with FTP access, we can perform a small customization and add a redirect to the homepage for you.

    Best regards,
    8Theme Team

    Avatar: modestyestore
    modestyestore
    Participant
    October 31, 2024 at 17:17

    Can you provide these customization with step by step process

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    November 1, 2024 at 14:56

    Hello, modestyestore,

    1) Kindly note that you need to have a child theme in place. Unfortunately, we are unable to verify whether you have one, as the provided access credentials are no longer valid.

    2) Additionally, you will need to add the following code to the functions.php of your child theme

    add_action('woocommerce_login_redirect', 'et_custom_login_redirect', 10, 2);
    function et_custom_login_redirect($redirect, $user) {
        if (is_account_page() && !is_wp_error($user)) {
            return home_url();
        }
        return $redirect;
    }
    
    add_filter('et_authorize_redirect', 'et_custom_social_login_redirect' );
    function et_custom_social_login_redirect() {
        return 'home';
    }

    Best regards,
    8Theme’s Team

    Avatar: modestyestore
    modestyestore
    Participant
    November 1, 2024 at 18:10

    Thanks for helping me, when I am login with social media then it is working.

    But when i am login with user name and password then it is not redirecting to home page.

    Avatar: modestyestore
    modestyestore
    Participant
    November 2, 2024 at 20:44

    I am waiting for your response. If you have any query then please let me know.

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    November 4, 2024 at 07:27

    Hello, modestyestore,

    Please try the following code:

    add_action('woocommerce_login_redirect', 'et_custom_login_redirect', 10, 2);
    function et_custom_login_redirect($redirect, $user) {
            return home_url();
    }

    Best regards,
    The 8Theme Team

    Avatar: modestyestore
    modestyestore
    Participant
    November 4, 2024 at 17:08

    Thanks a lot, It is working for both cases.

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    November 4, 2024 at 17:09

    Dear modestyestore,

    Choosing our theme reflects your commitment to quality, and for that, we’re genuinely grateful. As we constantly strive to elevate your experience, your feedback is an invaluable gift. Could you kindly take a moment to rate our product with 5 stars on ThemeForest?

    Click here to share your insights: https://themeforest.net/downloads

    Your support fuels our journey, and we appreciate it more than words can express.

    Best Regards,
    The 8Theme Team

  • Viewing 9 results - 1 through 9 (of 9 total)

The issue related to '‘Redirect to home page after login into site’' has been successfully resolved, and the topic is now closed for further responses

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.