[Resolved] Hiding Home Page From a Logged in Member

Home Forums Support [Resolved] Hiding Home Page From a Logged in Member

Home Forums Support Hiding Home Page From a Logged in Member

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1441751
    John

    Hi!

    The home page of our site has an invitation to visit a sales page for a membership offer. The primary menu has three links: HOME, CONTACT, LOG-IN.

    If a member logs-in, they are taken to a ‘WELCOME’ page. The HOME link is still in the primary menu, and is clickable. From a logged-in user perspective, the HOME page is no longer relevant, so its presence is confusing.

    What I’d like is that a logged-in user not see that HOME page link, in the primary menu, but it should still be visible to a logged-out user.

    How can this be done?

    Thanks!

    #1441768
    John

    Maybe I need a conditional display plugin. I’ll give this one a try and report back.

    https://en-gb.wordpress.org/plugins/if-menu/

    That worked to remove the HOME link in the primary menu when a user is logged in.

    Now I need a redirect so if someone goes to the homepage, and they are logged in, they will be redirected to another page on the site.

    #1441793
    John

    Ok… found the solution. This is a new snippet which I’ve called ‘If user logged in redirect from home page to posts page’

    add_action('wp', 'add_login_check');
    function add_login_check() {
    
            if ( is_user_logged_in() && is_page( #-of-page ) ) {
            wp_redirect('https://yhour-specoial-url.com');
            exit;
        }
    }

    Link to the solution: https://wordpress.org/support/topic/redirect-logged-in-users-2/

    #1441845
    Leo
    Staff
    Customer Support

    Hi John,

    So you are all good here?

    Let me know ๐Ÿ™‚

    #1441945
    John

    I am Leo. Thank you. Hope you don’t mind my adding this to the knowledge base. Thought it might be helpful to someone at some point.

    #1441947
    Leo
    Staff
    Customer Support

    No problem at all!

    We appreciate the reporting back ๐Ÿ™‚

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.