Archived topic
Hiding Home Page From a Logged in Member
5 replies · Started by John on September 13, 2020
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!
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.
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/
Hi John,
So you are all good here?
Let me know :)
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.
No problem at all!
We appreciate the reporting back :)