What is the best way to add/remove items for the wp_nav_menu()
based on user roles?
For instance a custom menu that looks like:
- Some Page
- Some Other Page
- Special Admin Page
Where the Special Admin Page
should only be visible for admin users.
Is this best done with wp_nav_menu_items
filter or do I need a custom Walker?
This is a possible duplicate of: Hide menu items for visitors and filter based on role but that doesn't appear to have been completely solved. Though it does mention a tutorial about a custom Walker that seems relevant.
EDIT:
Based on Toscho's answer and How to add a custom field in the advanced menu properties? I combined the two to form my own plugin
Fair warning that I cannot vouch for its speed and I am relatively certain that it will not work with another custom Walker, but it was a one-day plugin.