WordPress | How To Add Login/Logout To Main Menu

WordPress | How To Add Login/Logout To Main Menu

Tutorial showing you how to add Login/Logout to main menu on wordpress.

Link to code:

If your looking for top quality wordpress themes with great support I recommend you check out this site:


28 Replies to “WordPress | How To Add Login/Logout To Main Menu”

  1. hey can u plz help me! as in which code u pasted in your functions.php ????i an doing my final year project and i need to do this! i am a newbie and i dont knw much stuff. i am tired of findind videos which can actually show me how can users register themselves to my wordpress website! thjere shouldnt b any link to wordpress bt directly there should be a small form to fill n then they are registered and they can get excess to my website …plz help :/

  2. hey it still dint work out for me! as in i copied the code bt still it dint show up. i am using theme inFocus . some ppl say its with the theme and there cannt be login logout stuff. help!

  3. Hi, have you managed to get it working?

    Find this part of the code: “if ( $args->theme_location == ‘primary-menu’ ) {” and change the “primary-menu” part to the name of your menu.

    Not fully sure but it could be just ‘menu’ on the theme you are using.

    Please let me know how you get on.

  4. I posted a sample video from my new training, which will teach you how to create professional and profitable websites in a few hours. check it out: ==> /watch?v=ADq7H0bA4MM <– or go to my channel

  5. Hi

    Ive tried to do what you said but when i changed the functions file it crashed my site and i had to import the original file again to get it back up and running – i am using a niarra theme – i dont know if that helps?


  6. Thanks the code is working… the only thing you need to modify is this code “if ( $args->theme_location ==’primary-menu’)” change the primary to main…

  7. I am a web developer and I created some video tutorials for the use of wordpress. WP experts agree that it’s the best wordpress training ever created. Period. If you want to find out more, check out my channel. I posted a link for this amazing training.

  8. Question:
    1) How do I also add “Register” link when logged out, as in Register | Log in, in addition to Log Out.
    2) I need to translate Log in / Log Out / Register to another language. How can I do this?


  9. hi 
     this is  exactlyy  what i wanted to  do  but couldnt understand wht u  did

  10. Any chance to have only logout menu and after user click logout, there won’t be log in menu? Thank you!!!!

  11. Not working for me… I’ve changed “if ( $args->theme_location == ‘primary-menu’ ) section to reflect what I have called my menu but still no luck. Anybody have any other ideas? Thanks. 

  12. Hi, my problem is that the basic WP login/out logo thus not show when i want to enter my website.( this is what i’m getting to see. It looks like nothing was found at this location.) how can i solve this problem cause i want to finish my website. ( i’m a beginner and very new to WP) 

  13. VIDEO is TRASH!!!!  You’re going to have know code and be a very, very advanced user for this video to be applicable.  NOT FOR BEGINNERS

  14. Worked great BUT yea, you need to change “if ( $args->theme_location ==’primary-menu’)” and replace primary-menu to the actual name of your menu! Thanks!

  15. Many people say this is not for beginner. I raise the question, what is for beginner? there are so many ways to learn wordpress, so many things to learn before something else, really is it such a bad video? I think it was slow, the guy explained himself well, and in my mind well done for making it.

  16. Thank you for this. It worked perfectly. I do have a question though. I would like to add this to my footer menu as well. My footer is called ‘footer-menu’. I tried adding it as: if ( $args->theme_location == ‘primary-menu’, ‘footer-menu’ ) but that broke the site. Do you have advice on the right way to add this to my footer also?  BTW, I’m pretty much a beginner too. 😉

  17. can you please tell me. how can we enable a user to actually login on a website made through wordpress

Comments are closed.