How to add a WordPress logout link to a menu

If registered users visit your WordPress site, it could be helpful to give them the option to log out of the website. In this article, we’ll walk you through adding a WordPress logout link to a navigation menu or sidebar. 

One of the best places to add a logout link is in your site’s navigation menu because it allows site visitors to easily log out from any page.

  1. Log in to your WordPress dashboard.
  2. Go to Appearance > Menus.

3. 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.

http://example.com/wp-login.php?action=logout

4. In Link Text, add the text you want to display in the menu. In our example, the text is Log Out

5. Click Add to Menu.

6. 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. 

7. 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.

 

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 logout link by adding a text or HTML link to the sidebar.

  1. Log in to your WordPress Dashboard.
  2. Go to Appearance > Widgets.

3. We’re adding a custom HTML link to the sidebar in this example, so we’ll drag the Custom HTML widget from Available Widgets to the Blog Sidebar.

4. Enter a title for the widget. This will display in the sidebar above the link. In our example, the title is User Status

5. In Content, enter the following HTML code, replacing example.com with your domain name. Click Save.

 

The logout link is now displayed in the site sidebar.

More information

For more information about working with WordPress navigation links and menus, check out our Knowledge Base article: How to create good navigation links in WordPress.

If you need help with your HostPapa account, please open a support ticket from your dashboard.

Related Articles