Nav Menu Roles Plugin

Display or hide menu items based on user role

Over the weekend I was working on a project and my client needed to be able to hide certain menu links from non-logged in users.  In the past I have just created 2 menus, one for logged in users, and another for logged out users.  Not the most convenient thing ever, but simple enough.  However, since this was at least the second, and possibly the third time this has come up in various projects I decided to dig further.

Adding fields to the menu item back-end

This was the trickiest part really, because there aren’t any action hooks in this part of the code.  I have requested one with the following Trac Ticket, but until that gets added to we have to do it in a slightly less efficient way.

Thanks to this WordPress Answer I found that the whole menu item form is created by the Walker_Nav_Menu_Edit Walker, but that tucked away in the code is the ability to filter this and send a new Walker via the wp_edit_nav_menu_walker filter.  Actually this answer got me about 80% of the way there so I can hardly claim to be clever or original.  I just packaged it up.  Couples with this Answer about front-end menu Walkers, the first beta draft of my plugin was born.  At this point it really only handled different roles.

Nav Menu Roles screenshot

New options for menu settings allow you to customize who can view particular menu items

Before it was even added to the WordPress repository, Pippin Williamson did a quick video review, so I guess I am not the only person who has needed this ability from WordPress.  Pippin also had the cool idea to add the ability to show an item to all logged-in users, or all logged-out users, so the video screenshots will look different from the end result of version 1.0.  I think this was a cool addition, so thanks Pippin for the idea and for helping me work on it.

Basic Usage

Install and activate the plugin like normal. Create a custom menu and add items to it just like you usually would. You will now see the extra fields shown in the screenshot. From here you select to show the item to all logged in users, all logged out users… or to customize by role. If you chose customize by role, then you can use the checkboxes to determine which roles should be allowed to see this particular menu item. If you choose customize by role and do not check any roles, then the item will show to everyone just like it used to. There isn’t any more to it than that. It should be pretty straight-forward.


Now available in the WordPress Repo.

Also available via my Github repo.


Support is limited to bug-fixing and basic implementation. I can’t help with any customization.

Please report any bugs at Github’s issue tracker.  

Support requests are best handled in the Support Forums. Please don’t post support questions in the comments!

Enjoy! And let me know what you think.


  1. Nav Menu Roles Plugin | Pippins Plugins on September 18, 2012 at 3:50 pm

    […] can read more about the plugin on Kathy’s website. Download plugin Tweet Follow @pippinsplugins Kathy […]

  2. Jenny Ragan on September 20, 2012 at 6:23 pm

    I am djrmom from the WordPress Answer you linked to and I am very excited to see it put to use. I answered the question for the challenge of it but have never had any reason to actually use the code.

    • kathy on September 20, 2012 at 6:36 pm

      Hi Jenny! Thanks for stopping by… and definitely extra thanks for that WordPress Answer. Once I had that the solution was relatively trivial. I’m already using it on a live site and know a few others that are too. WordPress rules!

  3. Hamzah on October 2, 2012 at 4:31 pm

    Thanks Kathy,
    Amazing plugin, what i have waiting for, since years. Will review it and update u.

    Thanks again

    • kathy on October 2, 2012 at 5:26 pm

      Thanks for the kind words Hamzah. I’m glad it could be useful to you. Do let me know where you review it. Cheers.

  4. Paal Joachim Romdahl on October 29, 2012 at 12:42 pm

    Hey Kathy!

    The plugin looks very interesting! It seems like a standard feature that should be added to the WP core.

    Have a great day!

    • kathy on October 29, 2012 at 1:26 pm

      Thanks Paal. It has definitely been a handy add on for me and many others.

  5. Katya on December 12, 2012 at 1:43 am

    Thank you soooo much for creating this plugin!! It worked like a charm. I also have had to constantly create a custom menu for logged in or logged out users but this was the best plugin I could have found. Thank you!!! Its much appreciated.

    • kathy on December 12, 2012 at 2:12 am

      You’re welcome! I’m pretty sure it is the only plugin that does this. :) Glad it could help you and thanks for stopping by.

  6. Jme on December 24, 2012 at 3:33 pm

    What a great simple, but oh so useful plugin. Thank you!

  7. Brian on December 31, 2012 at 2:11 pm

    Great job, Kathy.

    How do I get a menu item to appear on both logged in and logged out menus?


    • kathy on December 31, 2012 at 7:04 pm

      As per the instructions, if you don’t check any boxes, the menu item will be visible to all users like normal. Thanks for dropping by!

  8. komal on February 8, 2013 at 6:00 pm

    Hey Kathy,

    I have tried to use it with 3.4.1 and 3.5.1 with S2 Member plugin. It is getting installed without any error but is not showing up anywhere in menu section. Please let me know the possible solution.

    Thanks, Komal

    • kathy on February 8, 2013 at 6:06 pm


      I’ve replied to your thread in the WP forums, have a bit of patience! :) But for anyone else with the same/similar issues, WordPress does not have the appropriate hooks required. When core is updated, I will update my plugin to not use a custom Walker for the admin menu items. Until then, my plugin is not compatible with any other plugin attempting to override the same Walker…. which I suspect is what S2 is doing. Basically, “there can be only one”, Walker and it looks like mine is losing out to S2’s.


  9. Finch on February 11, 2013 at 6:39 pm

    Nice. This plugin is really damn useful. Btw, can this also restrict users to the pages even if the user knows the exact permalink of the page that he or she doesn’t have the right to view?

    • kathy on February 11, 2013 at 7:08 pm


      Glad you like the plugin! But no, it only toggles the menu state, this plugin doesn’t restrict access to any content… that’s more suited to a membership plugin.

      Good luck,

  10. Rob Yardman on February 25, 2013 at 11:54 pm

    This is great, Kathy!

  11. Stanley on May 14, 2013 at 10:06 pm

    Hello Kathy! you are truly Awesome. Wonderful Plugin! ur a Life saver. Keep up the good work!

  12. Jamie Mitchell on May 18, 2013 at 4:07 am

    Kathy, you are certainly awesome all right

    This plugin is perfect for what i need ! Thankyou :)

  13. Sue on May 27, 2013 at 6:47 pm

    This was just what I needed for my S2 Member wordpress site! Awesome is right!

  14. shikha on June 2, 2013 at 1:39 pm

    your plugin does not work on my website.. its not hiding the menu item in menu bar.. I used all logged in feature but before login. visitors are accessible to use it.. can you plz help me

  15. Pavels on September 14, 2013 at 6:35 am

    thank you very much for this plugin, you are awesome, Kathy!

  16. Matias on September 19, 2013 at 4:31 pm

    Great plugin!! Thanks a lot! Easy to use.

  17. Glen on October 25, 2013 at 7:17 am

    Kathy in a word you are a LEGEND!!!!!! I can see you have received a lot of positive feedback here which is well deserved. It is members of the WordPress community like you that make this such an interesting platform for both developers and unskilled gurus alike. Here you have developed something which is elegant and simple. THANKYOU! :)

    • kathy on October 25, 2013 at 12:47 pm

      Thank you for the kind words and the ego boost! I especially needed those today as my current code does not feel elegant or simple at the moment.

  18. Rosemarie on November 5, 2013 at 11:52 am

    That’s brilliant Kathy! Just what I needed to work with S2 Members today – thank you!

  19. Kim Coleman on November 15, 2013 at 10:41 am

    I’ve been using this plugin on a lot of our sites lately and wanted to see about extending it to incorporate the membership levels as set up by our plugin. Are there hooks to extend or a best practice for looping in your code?

    • kathy on December 6, 2013 at 1:24 pm

      Nav Menu roles does now let you roll your own integration for non-standard levels/roles, see the .

  20. Claus Nehring on January 5, 2014 at 3:59 pm

    Hi Kathy, thanks a lot for this great plugin. You made my day :-)

    • kathy on January 5, 2014 at 10:06 pm

      Hi Claus,

      Thanks for dropping by. I’m pleased that my plugin was able to help you.


  21. Glen Clay on January 31, 2014 at 8:01 pm

    Is there a way to make the Nav Menu Roles compatible with the enfold theme? You have a great plugin and they have a great theme that don’t seem to get along. :)

    • kathy on January 31, 2014 at 9:23 pm

      I don’t know anything about the Enfold theme. However, NVR is compatible with any theme that is using wp_nav_menu() on the front and isn’t adding their own Walker in the admin section. Unfortunately WP has yet to add the appropriate hooks to the admin side that allow my fields to be added without the more nuclear, Walker, total replacement approach.

      • Glen Clay on January 31, 2014 at 9:46 pm

        That explanation helps me a lot! Thank you!!

  22. Seth on February 4, 2014 at 8:07 pm

    Hi there –

    I really like your plugin. I wonder if you can guide me to a solution to help incorporate it into my real estate theme. When logged in, my new logged-in “employee menu” doesn’t immediately appear on the homepage. Occasionally it will pop-up on the homepage if I click away from the main page, and then return. I haven’t been able to discover a rhyme or reason to this. The employee menu does appear on the other pages, though. Thanks for any help you can provide!

    • kathy on February 5, 2014 at 9:57 am

      I suspect your theme is at fault (or a caching plugin maybe?), so try looking at the code that is generating the menu… commonly in header.php. But if you can reproduce the error in a default theme then please post an issue in the forums.

  23. Michael James on February 12, 2014 at 2:50 am

    My goodness – You are Awesome! Thanks! It is super easy – with lots of cool choices and works great with my membership plugin.

  24. Mohamed Salman on February 12, 2014 at 11:32 am

    Hi Kathy, This is really Nice Plugin. But i found some issue after installing this. I don’t know whether it is not supporting because of my theme or this plugin has not been installed properly.
    I would like to install this plugin in a website called, where user can see posts on subjects only when they are registered.
    But after installing it also, it doesn’t show me the “display mode” and “access role” option under category.
    Please help me in fixing this.
    Thanks in advance.

    • kathy on February 12, 2014 at 12:00 pm

      Hi Mohamed,

      Support is handled at the official WordPress forums. However, this issue is covered by both the Please Read before Posting thread in the WordPress Forums and in the FAQ.