Support » Plugin: Menu Item Visibility Control » Hide Menu according to Groups/Roles

  • Hi,

    I was wondering how this plugin works for hiding menu with roles, can it work similarly for groups as well?

    Also what happens if I want to show a particular menu item to guests and replace it with another menu item for a certain role/group of users.

    So example

    Members Page (Guest View) is visible to all guests

    Members Page (Paid) is visible to only paid guests of certain role/group and the previous menu item which was visible to all is now replace by this menu item.

    Look forward for some help.

Viewing 1 replies (of 1 total)
  • Plugin Author shazdeh

    (@shazdeh)

    Hi,

    For that you basically need two menu items. One that is supposed to show only to guests and for that one you can use the condition:

    
    ! is_user_logged_in()
    

    The second menu item which you want to show only to users from certain user roles and for that use the current_user_can WordPress function to check whether user has a particular “capability” or not:

    
    current_user_can( 'manage_options' )
    

    I’d advise you to give this page a look: https://codex.wordpress.org/Roles_and_Capabilities.

Viewing 1 replies (of 1 total)
  • The topic ‘Hide Menu according to Groups/Roles’ is closed to new replies.