WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've just setup a new Blog for a friend and thought it's better to not give him Administrator Access right away as a pre-caution.

I created a new user as Editor therefore.

But then I saw that this user can not change the Theme Settings like Background and Header.

Is there an easy way to allow the Editor Role to edit any theme settings in Twenty Ten or a Child or it? He should basically be able to do anything an Adminsitor can do reg. the Theme, probably even changing themes.

share|improve this question
2  
Reminds me … I have written a plugin for that: Theme options for editors – toscho Sep 14 '14 at 14:22
up vote 15 down vote accepted

you can add capabilities to the editor role using the role object and add_cap from you functions.php

<?php
   // get the the role object
   $editor = get_role('editor');
   // add $cap capability to this role object
   $editor->add_cap('edit_theme_options');
?>

you can also remove capabilities:

$editor->remove_cap('delete_posts'); 

just take a look at the list of capabilities and what each one means.

share|improve this answer
3  
Cool, that did work! For the shorties: get_role('editor')->add_cap('edit_theme_options'); :) – hakre Mar 25 '11 at 0:55
1  
@hakre FYI Direct variable assignments like that a()->b() will not work in PHP versions prior to 5. – hitautodestruct Apr 10 '13 at 8:40
    
As roles are typically stored in database, updating roles should be done in a plugin and there within a activation/deactivation hook. It just is not necessary to run this code on every WordPress process. – David Mar 14 at 8:35

Don't they need the "edit_themes" capability? You can use Justin Tadlocks plugin http://wordpress.org/extend/plugins/members/ to edit the capabilities associated with each role.

share|improve this answer
    
Thanks for the answer. – hakre Mar 25 '11 at 0:56
    
This answer just got me out of a bind. Thanks! – Doug Dec 22 '11 at 16:34

Since this is the 1st hit on google for this question, I feel this is the right place for an update:

For me, I couldn't get it to work via edit_theme_options. Then I read the plugin source and found out that it's actually manage_options. And it worked.

tl;dr:

$role_object = get_role( 'editor' );
$role_object->add_cap( 'manage_options' );

works for me (in the year 2014)

share|improve this answer
    
Great stuffs dude... – Abbas Dec 30 '15 at 5:59

Another great plugin is User Role Editor (http://wordpress.org/extend/plugins/user-role-editor/). It is similar to Members, but much more basic and simple to use. Plus, the developers are always around to listen to feedback and offer assistance, if needed.

share|improve this answer

This is old, but here's a newer way you could achieve this:

add_filter( 'user_has_cap',
function( $caps ) {
    if ( ! empty( $caps['edit_pages'] ) )
        $caps['edit_theme_options'] = true;
    return $caps;
} );
share|improve this answer

protected by toscho Sep 14 '14 at 14:18

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.