I have one “branch” of my main site’s navigation tree that should only be accessible to a set of registered, logged-in users. I understand how to query a user’s role and capabilities. This question is specifically about what is the best way to leverage the build-in nav menu, but just hide an item conditionally.

Do I need to overload the built-in default navigation and write a custom query and build the navigation structure manually? I’d love to avoid this if possible.

I don’t need full code samples, just your ideas and general framework / approach.

Appreciate the advice!

T

6 s
6

Use your own walker and check the capability before you create an item.

Leave a Reply

Your email address will not be published. Required fields are marked *