• Resolved indiastartup360

    (@indiastartup360)


    I want to hide homepage to logged in users. When users come to homepage after logged in, they should redirect to another home page. How this possible?

    Thanks in advance…

    Note:
    Ultimate Member –> User Roles –> Myrole –> Can view default homepage?
    This option is uncheck, and redirect link is given. But not redirecting to another home page. Can you help me?

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @indiastartup360

    Have you tried editing your Homepage and then see the “UM Content Restriction” settings?

    Regards,

    Thread Starter indiastartup360

    (@indiastartup360)

    Hello @champsupertramp

    yes, I have tried. But didn’t resolve my issue.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @indiastartup360

    You can try this code snippet to redirect the user to another page when visiting the default homepage.

    add_action("template_redirect","um_020121_redirect_to_another_homepage");
    function um_020121_redirect_to_another_homepage(){
        if( is_home() || is_front_page() ){
            if( is_user_logged_in() ){
                wp_redirect("/secondary-homepage/"); exit;
            } 
        }
    }

    Regards,

    Thread Starter indiastartup360

    (@indiastartup360)

    Thank You so much!

    It works… But It is redirecting admin too…

    Anyway, thank you for your support.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @indiastartup360

    You can try this code snippet to exclude the administrators from being redirected to custom page when visiting the homepage:

    add_action("template_redirect","um_020121_redirect_to_another_homepage");
    function um_020121_redirect_to_another_homepage(){
        if( is_home() || is_front_page() ){
            if( is_user_logged_in() && ! current_user_can("manage_options") ){
                wp_redirect("/secondary-homepage/"); exit;
            } 
        }
    }
    

    Regards,

    Thread Starter indiastartup360

    (@indiastartup360)

    Thank You so much! It works well…

    One final question, If I have different home pages for different user roles, What should I do?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to hide homepage to users?’ is closed to new replies.