Nav Menu Roles

Wordpress Plugin
Download latest - 2.1.0

Download Stats

Today 1,872
Yesterday 2,363
Last Week 10,125
All Time 782,255
Banner 772x250

This plugin lets you hide custom menu items based on user roles. So if you have a link in the menu that you only want to show to logged in users, certain types of users, or even only to logged out users, this plugin is for you.

Nav Menu Roles is very flexible. In addition to standard user roles, you can customize the functionality by adding your own check boxes with custom labels using the nav_menu_roles filter and then using the nav_menu_roles_item_visibility filter to check against whatever criteria you need. You can check against any user meta values (like capabilities) and any custom attributes added by other plugins.

IMPORTANT NOTE

In WordPress menu items and pages are completely separate entities. Nav Menu Roles does not restrict access to content. Nav Menu Roles is only for showing/hiding nav menu items. If you wish to restrict content then you need to also be using a membership plugin.

Usage

  1. Go to Appearance > Menus
  2. Set the "Display Mode" to either "logged in users", "logged out users", or "everyone". "Everyone" is the default.
  3. If you wish to customize by role, set the "Display Mode" to "Logged In Users" and under "Restrict menu item to a minimum role" check the boxes next to the desired roles. Keep in mind that the role doesn't limit the item strictly to that role, but to everyone who has that role's capability. For example: an item set to "Subscriber" will be visible by Subscribers and by admins. Think of this more as a minimum role required to see an item.

Support

Support is handled in the WordPress forums. Please note that support is limited and does not cover any custom implementation of the plugin. Before posting, please read the FAQ. Also, please verify the problem with other plugins disabled and while using a default theme.

Please report any bugs, errors, warnings, code problems to Github


Releases (29 )

Version Release Date Change Log
2.1.0 2022-02-24
  • New: Add support for "hiding" a menu item by role.
2.0.2 2021-12-18
  • Fix: PHP Fatal error: Uncaught Error: Call to undefined method WP_Customize_Manager::settings_previewed(). settings_previewed() does not exist until WordPress 3.9.0+.
2.0.1 2021-03-18
  • Tweak: Alphabetically sort role names.
2.0.0 2020-08-29
  • New: Customizer support! props @westonruter!
1.10.2 2020-07-06
  • Fix: Strict array typecasting for nav menu classes.
1.10.1 2020-03-26
  • Fix: Only auto-apply classes on front-end. Prevents appending duplicate classes on each save.
1.10.0 2020-03-26
  • Fix: My hook made it into core for WP5.4!! Can finally stop overriding the admin menu Walker.
1.9.5 2019-10-09
  • Fix: PHP Notice: Undefined variable $item
1.9.4 2019-10-08
  • Add the NMR roles as css classes to the menu output
  • Improve menu editor role checkbox list UX, by making list items full-width. Props @lkraav
1.9.3 2018-12-31
  • Check all object properties exist before accessing. Resolves PHP notices for custom menu items.
1.9.2 2018-05-02
  • Include a !empty() check on menu $items
  • Update donation link
1.9.1 2017-11-03
  • Update donation link
  • Update required and tested against versions
1.9.0 2017-11-03
  • Add support for multisite. Props @open-dsi and @fiech.
1.8.6 2017-10-31
1.8.5 2016-12-08
  • Use new Walker for WP4.7
1.8.4 2016-12-08
  • Prevent nav menu items edited in the customizer from rendering when they should be excluded
1.8.3 2016-12-07
  • Remove deprecated screen_icon()
1.8.2 2016-06-13
  • Reduce number of parameters passed to add_action_links filter
1.8.1 2016-05-06
  • Switch input names to use a counter [nav-menu-role][100][1]. For some reason [nav-menu-role][100][] doesn't post an array and hypenated names [nav-menu-role][100][gold-plan] wreak havoc on the save routine. Shouldn't impact anyone not using hyphenated role names.
1.8.0 2016-05-04
  • Fix style issue in WordPress 4.5
1.7.9 2016-03-11
  • revert priority of walker back to default because themes are not actually using the hook to add their own fields. sadface.
1.7.8 2016-02-17
  • remove all admin notices
1.7.7 2016-02-17
  • add fancy debug messages
1.7.4 2015-12-05
  • Change language in metabox to try to explain min caps versus strict role checking
  • keep tweaking the FAQ
1.7.3 2015-12-04
  • update readme, update error notice, add more links to the FAQ
1.7.1 2015-09-25
  • Updated FAQ with patch instructions for conflicting plugins/themes
  • add Italian language. props @sododesign
  • add Portugeuse language. props @brunobarros
1.7.0 2015-06-08
  • adjust admin UI to be more user-friendly. Options are now: show to everyone, show to logged out users, and show to logged in users (optionally, logged in users by specific role)
1.6.4 2015-01-22
  • more language issues -> sync svn+git version numbers
1.6.3 2014-10-20
  • Try again to add languages. Where'd they all go?