If you’re creating a website where users can signup and become members then you need to make it easy for members to login and logout of your site. The easiest and most noticeable place is to add login and logout links to your site’s navigation menu.
However, the default WordPress menu system does not provide an option for showing certain links when someone is logged in or logged out. So to add a login and logout link to your menus you will have to either use custom code or use a plugin that provides this functionality.
If you are looking for a simple login/logout menu link plugin a popular choice is the BAW Login/Logout menu plugin. However, in this article I am going to show you how you can add login and logout links to your site using Ultimate Member.
Login and Logout links with Ultimate Member
With login and logout links the desired result is to show the login link to guests and show the logout link to logged in users. To do this you need to apply some conditional logic to the login and logout menu items which with Ultimate Member is extremely easy to do.
Adding the login and logout links to the menu
By default when you activate Ultimate Member the plugin will create several core pages two of which are a login and logout page. So when you go to add items to your menu these two pages will already appear in the pages list. Simply select the login and logout pages and click the add to menu button and the two links will appear on the menu.
Applying the conditional logic
The next thing you want to do is expand both the login and logout menu items so show the Ultimate Member menu settings. To setup the links correctly you need to select “Logged Out Users” for the login link and for the Logout link you need to select “Logged in Users” and then select the user roles that can see the link.
Once you have done this save the menu and you will then have a login link that shows for guests and a logout link that shows for logged in users on your site’s menu.
Got a question?
If you have a question about login/logout links or Ultimate Member in general feel free to post on our community forum where I will be more than happy to answer any questions you have!