HOW TO: Add a WordPress log out link to a menu
Posted by Sugen S. on 21 September 2018 02:48 PM
In a default WordPress installation, the only place the log out link is displayed in is the WordPress admin bar. If your WordPress site is designed primarily for registered users, it can be helpful to add a log out link to the navigation menu.
Adding a log out link to a navigation menu
One of the best places to add a log out link is in your site’s navigation menu. Adding the link here will make it easily accessible on every page of your site.
Log in to your WordPress dashboard and go to Appearance > Menus.
Expand the Custom Links section and add the logout URL in the URL field, making sure to change example.com to your domain name and change the path to your WordPress installation folder, if necessary.
You should now see the Log Out link in the Menu Structure. If you want to change the order of the menu links, drag the links to the correct position. When you’re happy with the menu links, click Save Menu.
You should now see the Log Out link on your site’s navigation menu.
Adding a log out link to the sidebar
The default sidebar Meta widget includes log in and log out links. However, if you don’t want to use the Meta widget, you can still display a log out link by adding a text or HTML link to the sidebar.
Log in to your WordPress Dashboard and go to Appearance > Widgets.
In this example, we’re adding a custom HTML link to the sidebar, so we’ll drag the Custom HTML widget from Available Widgets to Blog Sidebar.
Enter a Title for the widget. This will be displayed in the sidebar above the link. In our example, the title is User Status. In Content, enter the following HTML code, replacing example.com with your own domain name. Click Save.
The log out link is now displayed in the site sidebar.