Give Editor Access To Sidebar

The edit_theme_options capability should allow the user to edit the sidebar as described on this page :
http://codex.wordpress.org/Appearance_Widgets_SubPanel

Code to add to functions.php

   $role = get_role('editor'); 
   $role->add_cap('edit_theme_options');

Edit:

This should work to prevent editor accessing themes or menus

function custom_admin_menu() {

    $user = new WP_User(get_current_user_id());     
    if (!empty( $user->roles) && is_array($user->roles)) {
        foreach ($user->roles as $role)
            $role = $role;
    }

    if($role == "editor") { 
       remove_submenu_page( 'themes.php', 'themes.php' );
       remove_submenu_page( 'themes.php', 'nav-menus.php' ); 
    }       
}

add_action('admin_menu', 'custom_admin_menu');

I haven’t had chance to test this, but it only removes them from the menu they may still be able to access them by typing in the URL directly.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)