Add login/logout link to WordPress navigation menu using functions.php

WordPress doesn’t have an option to add login or logout links to navigation menu based on user login status. But you can add login/logout link to WordPress navigation menu using funcitons.php. wp_nav_menu_items filter hook helps you to do it from functions.php.

Following snippet adds login or logout link to navigation menu.

Add the above code in functions.php. You can change theme location name “primary” with yours to add login/logout menu to a specific navigation menu.

Hope this helps.

How to Add a Login/Logout Link to Your WordPress Menu
login logout wordpress without plugin
wordpress login logout menu plugin
login logout plugin
wordpress logout link with redirect
wordpress logout menu item
Add “Logout” link to navigation menu
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.