26 thoughts on “WordPress | How to add Login/Logout to main menu

  1. 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. ;-)

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

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

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

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

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


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


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

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

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

  12. 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 :/

  13. Hi,
    I am trying to add the login link to the main navigation menu for a long time. I follow each step you present, but it does not work! What am I doing wrong? I thought that the reason might be the template I use. But switching to Twenty Eleven does not change anything. The login link is not in the main menu. I'm driving crazy and I would be very very grateful if you could help me.

    Many thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *