Long time lurker, but first time poster. I’ve searched Google extensively and just can’t seem to come up with an answer on this problem.
I use Justin Tadlock’s excellent ‘Members’ plugin for roles and permissions on several client installations of WP. I’ve recently deployed a theme where the client should only have access to the Appearance -> Menus item, but none of the others sub-items in the Appearance menu of the admin.
When enabled, the role ‘edit_theme_options’ enables the user to access ‘Themes’, ‘Widgets’, and ‘Menus’. How would I go about filtering the submenu so that if the role ‘edit_custom_menus’ is assigned, the ‘Menus’ link will show?
Upon further searching and after discovering the $submenu global variable, I’ve managed to find a helpful tutorial on removing sub-menus from the WordPress admin.
I’ll post with code when I get a full solution implemented and integrated with the plugin.
I don’t use plugin myself, so speaking theoretically. There are two parts to this:
current_user_has_role()
function for this.