How to Add Login and Logout Link in WordPress Navigation Menu

How to Add Login and Logout Link in WordPress Navigation Menu

It is possible that you create a membership website so that people can sign up an account and log in to get the premium content. In this case, you should make the login and the logout link obvious so that readers can get the easy browsing experience. And surely, the navigation bar is the best place. However, the default menu system of WordPress does not allow you to do so. So, you should achieve this purpose manually. This time, we’d like to come out the simple steps of how to add login and logout link in WordPress navigation menu.

Add the Code in Your functions.php File

The first method is to add some simple lines of code into the functions file of your website. Here, you just need to enter the Appearance section of your website admin and click the Editor > Theme Functions button. And then, you can copy and paste the following code into this file and click the Update File button.

Login Logout Code

This way, the login and logout link will appear in the navigation bar automatically no matter where your navigation bar is located.

Make Use of the WordPress Plugins

If you are not comfortable with using the manual method, you can also download the useful WordPress plugins to do this for you. Here, we have introduced three options for you to choose.

Login Logout Menu

Download

With this plugin, you can add the real login and logout links into the menu bar automatically. No further settings are required.

After the installation, you can click the Appearance > Menus button. Here, you can find the new option of Login/Logout Links. You just need to click this option to open the dropdown list. Here, you can tick the check boxes of Log In, Log Out, Login/Logout and Register. You just need to choose your wanted options and drag them to your navigation menu.

Then, you need to enter the URL, the navigation label and the title attribute for each link for the proper display.

Login Logout Menu

Login-Logout

Download

This plugin does not showcase the login and logout links in the navigation menu. Instead, you can show these two link options at the sidebar. After the installation, you can click the Appearance > Widgets button to drag the new widget of Login-Logout into the sidebar. And then, you should enter the widget title, button text, welcome information, redirected links after the login and logout and the extra item when users are logged in and logged out.

Login-Logout Widget

Login Logout Register Menu

Download

This is the most powerful plugin among these three options. Upon the installation, you just need to click the Settings > Login Logout Register button. Here, you can enter the URLs for the login page, logout page, login redirection page and logout redirection page.

Login Logout Register Menu

After saving the settings, the links can be added just like the below example.

Login Logout Sample