3

I am trying to add/enable the theme editor for the editor role. The editor role by default doesn't have the option to manage theme options, so I addded this to functions.php:

// get the the role object
$role_object = get_role( 'editor' );

// add $cap capability to this role object
//$role_object->add_cap( 'edit_theme_options' );
$role_object->add_cap( 'manage_options' );

But still, I don't see the theme editor option. In the end, I want the theme editor to be the only submenu option.

Any suggestions?

4

The edit_themes capability is what allows access to Appearance > Theme Editor:

function wpse243341_modify_editor_role() {
    $role = get_role( 'editor' );
    $role->add_cap( 'edit_themes' ); 
}
add_action( 'admin_init', 'wpse243341_modify_editor_role');
1
  • 1
    Just wanted to say Thank You for this code it helped me immediately! Mar 1 '17 at 2:55

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.