Some presumptuous plugins out there inject themselves at the top of the WordPress admin menu,…
Every once in a while, you may find it necessary to restrict who can see links in your navigation. For instance, a Login or Registration link might only be useful for logged out users, and a “Go To Admin” link may only be necessary for Administrators. Nav Menu Roles Let’s you define who can see navigation by user roles.
What’s It Do?
Nav Menu Roles adds a new section to your menu edit window which lets you specify who can see each link. You can chose to show links to “Logged In Users,” “Logged Out Users” or “By Role.” With the latter option, you can define which user roles (Administrator, Editor, etc.) has access to the navigation items. All of this is controlled in the Menu section of your admin panel, and each menu item has it’s own customizable options.
How’s It Work?
Once you install and activate the plugin, go to Appearance -> Menus. Not much will have changed, and you can still create and edit menus in the same way. Select which menu you would like to edit from the drop-down at the bottom of the page, then simply add pages, external links or categories from the right sidebar to that menu, just as you normally would.
If you click the down arrow next to any menu item, you will see a list of options for it. This is where the Nav Menu Roles options are located. You will see a new section called “Display Mode” with three options.
- Logged In Users will show this specific menu item only to users that are logged into your site, with any user role assigned to them.
- Logged Out Users will show the menu item to users that are not currently logged in.
- By Role will bring up a set of drop-boxes listing every user role from site, by default Administrator, Editor, Author, Contributor and Subscriber. Simply check the boxes next to the labels to show the menu exclusively to that role.
If you’d like to show the menu to everybody, regardless of user role (in other words, to act like a normal menu item), simply select the “By Role” option and do not check anything off the list. This will ensure that anybody visiting your site can see the link. This is also the default option when new items are added to your menus, so if you don’t want to restrict access, you don’t have to do a single thing.
When you are all finished defining user roles, just click “Save” and see your restrictions in action.
Costs, Caveats, Etc.
Nav Menu Roles is free and updated to keep up with the latest versions of WordPress. If you are having problems with the plugin then you can visit the support forums for help.
The code is also hosted on GitHub if you would like to contribute to the project.