Support » Plugin: Nav Menu Roles » Detect if page is part of hidden menu

  • Resolved batman42ca


    Is there a way, that I can programmatically check to see if a page is part of a menu that is only available to logged in users?

    My plan is as follows: If the member is not logged in, they can’t even see the menu item. That’s standard nav-menu-roles behaviour. But if they are logged in but not paid, I want them to see the menu item, but not see the content of the page.

    I know how to set up a hook in functions.php. All I need to know is what to check how to see if the page that is about to be displayed belongs to a menu that is configured to be hidden from logged out users. Where in the database is that menu configuration information stored and how can I read it and use it?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author helgatheviking


    NMR saves its information as post meta for each menu item, with the key “_nav_menu_role”. Possible values being “in”, for showing only to logged in users, “out” for showing to logged out users, or an array of allowed roles.

    I’m not sure how to connect a page to a menu item, menu items are their own post type.

    Good luck.

    Thanks. That’s exactly what I needed to know. The rest of what I need to know is a WordPress issue, rather than a plugin issue.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Detect if page is part of hidden menu’ is closed to new replies.