Would you like to provide your users a log out link on your site that they can easily access from your WordPress menu? This tutorial will walk you through the steps on how to add a log out link to your WordPress menus.
Requirements: This tutorial is intended for use with the User Registration addon, which requires a Pro license level or higher.
Installing the If Menu Plugin
With the User Registration addon you can easily provide registration and log in forms throughout your site.
However, logout links (or buttons) are typically found inside a WordPress menu which is outside of WPForms.
This tutorial will show you how you can easily create a logout link inside your WordPress menu and make it so that it’s hidden unless your user is logged in.
The easiest way to do this without adding a bunch of extra code to the site would be to install and activate the If Menu WordPress plugin.
For details on how to add a plugin to your site, you might want to check out WPBeginner’s guide on how to install a plugin.
Add the Custom Log Out Link
To create a new item to your menu, simply go to your WordPress admin area.
In the left menu, you’ll need to click on Appearance » Menus.
Select the menu you want to add this link to.
On the left side, you’ll see the Custom Links box. Here, just add this custom link to your site:
Remember to change the
http://mysite.com/ to match your own domain name.
Once you’ve added your log out link and your label for that menu item, click the Add to Menu button to add this to your menu.
Set the Visibility Options
Now you’ll notice a checkbox to Enable visibility rules. Check this box so you can set up your conditional statement to show or hide this log out link.
Once you click that checkbox, you’ll see you now have more options to either Show or Hide your items based on what you choose in the dropdown.
For the purpose of this tutorial, we’re going to tell the plugin to only show this menu item if the user is logged in. So we’ll set the item to Show if the user is logged in.
It’s a good idea to make sure this is the last item in your menu to keep it easy enough to show and hide as needed.
Finally, click the Save Menu button to save your changes.
And that’s it! You’ve now successfully added a logout link to your WordPress menu!
Next, would you like to allow more file types to be uploaded in your forms? Then be sure to check out the article on How to Allow Additional File Upload Types.