I searched high and low for a plugin that can remove/hide Admin menu items , including custom post types and taxonomies, based on user role.
Every one I have tried only does a global hide, not based on user role. Other more complex ones like adminize do not display custom post types or taxonomies.
Do I have to write my own function or is there a simple plugin I am overlooking?
Update:
reading mike’s answer again got me thinking that you can add a new capability to a role and use that as you removal condition, so:
Old answer
I completely agree with what mike posted but if you’re not up to custom coding
Take a look at Admin Menu Editor plugin.
it lets you set access rights by level.
There’s a plugin that created for exact question: Hide Admin Menu. This plugin can:
Another good thing from this plugin is it’s intuitive and easy to use.
Hi @Wyck:
I can definitely appreciate your needs; I’ve had clients ask for the same. Unfortunately though, WordPress ties admin menu pages (i.e. menu sections) and menu subpages (i.e. menu items) to capabilities, not to roles.
However it would not be too hard to write some plugin code that allows you to assign admin menus options to roles instead; your script would set the capability required for all menu options to require a new
'not-allowed'
capability and then have your code selectively assign the default'read'
capability to every menu option where the current user’s role has the defined capability.The bigger question then becomes how to your represent the mapping of user roles to menu options? I could see that requiring a pretty elaborate admin user interface. Of course if you just want to hardcode an array that defines which roles can see what, it’ll be pretty easy…
This will keep only a couple of menu items for non-administrators. @Bainternet’s version uses
add_cap
, which should be done only once, on theme or plugin activation.