Find out in this tutorial how to display a different front page in WordPress depending on whether the user is logged in or not using a simple code snippet.
This strategy is especially interesting for membership sites, since the usual is to have a main page where you show the benefits of being a subscriber, but once the user is logged in you want them to have quick access to the content (tutorials, courses…).
In fact, I use this strategy on this page. 😉
Let’s see how to achieve this using WordPress conditional tags and the
Snippet to show a different home page to logged in users in WordPress
Add the following code at the end of functions.php or in your functionality plugin:
It’s that simple.
In this case you use the
wp_redirect function so that users who are logged in and on the home page are redirected to the tutorials page (/tutorials/).
The conditional tags you use are
To customize the snippet and have them redirect to the page of your choice, just replace the URL “https://yourwebsite.com/tutorials/” with the URL of your choice.
Now you know how to get a different home page displayed if the user is logged in or not.
This is a trick I use in almost every subscription website I create.
Any questions? Let me know in the comments.
And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉