0

I have 6 menu theme locations setup with "register_nav_menus"

I would like editors to be able assign custom menus to 3 of those locations and keep the other 3 only available to administrators.

How would one go about doing this? I could not find a hook or filter to help.

0

Check user capabilities or roles when registering the navigation menu. The data will remain accessible via wp_nav_menu, but users without the capabilities won't see the location in Appearance -> Menu -> Manage locations.

Note this will only prevent assigning menus to these locations. Any menu assigned to the location already will be manageable (if the user has the capability). To resolve this you can access the filter "wp_get_nav_menus" to strip menu items from the select menu drop down.

|improve this answer|||||
  • I will test when I get home but wouldnt checking for capabilities before registering not show the menu on the front end for the logged in user? I want the menu to appear on the front end for everyone but not be modifiable by certain capabilities in the admin area. Maybe I could check for capabilities and is_page() – chris Feb 20 '15 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.