Support » Plugin: Menus » Customize menus based on role

Viewing 1 replies (of 1 total)
  • Plugin Author David Sader


    My Menu plugin removes the menu from the backend altogether – for all roles. It won;t do what you ask via roles.

    There is help in the codex to fashion your own plugin to remove a capability from a role, once you remove the cap, then any menu citing it will disappear:

    So, figure out which capability is needed to see a menu item, then use your own plugin to remove that cap from a particular role.

    Most of the default menus are added in the core file /wp-admin/menu.php

    All the WP roles and capabilities are listed here:

    So putting it all together, adding a snippet such as the following to your own mu-plugins folder could accomplish what you are after (customize your own $editor and $caps variable):

     * Remove capabilities from editors.
     * Call the function when your plugin/theme is activated.
    function wpcodex_set_capabilities() {
        // Get the role object.
        $editor = get_role( 'editor' );
    	// A list of capabilities to remove from editors.
        $caps = array(
        foreach ( $caps as $cap ) {
            // Remove the capability.
            $editor->remove_cap( $cap );
    add_action( 'init', 'wpcodex_set_capabilities' );

Viewing 1 replies (of 1 total)
  • The topic ‘Customize menus based on role’ is closed to new replies.