I'm trying to create a new role within my wordpress theme that has almost all the same rights as an admin. Basically, it's a cross between Editor and Administrator. One of the issues I'm having is allowing the Editor to "see" the add custom image header submenu in Appearances. I either want to allow the Editor to see that submenu or create a new role that allows them almost all the same capabilities as an admin. I saw the below link on cloning a role but how do I go about taking capabilities away and finding out what those capabilities would be?




For a list of capabilities by user level, check the Roles and Capabilities Codex page.

The capability that would allow a user to change a theme header would probably be edit_theme_options, but I bet it would give your editors more capabilities than just messing with the header, though. It's hard to say for sure without knowing what theme you are using.

The problem with creating a custom capability, on the other hand, is that unless you have access to the function which is creating the menu item which you want to allow access to, it won't do you any good (and I don't think custom headers, specifically, are a feature which you can tweak easily via theme functions, unless it's an entirely custom-built functionality -- i.e. not the one you will find in the default WordPress themes like Twenty Eleven).

So I'd say: clone the role and adjust capabilities.

To take capabilities away from a role, use something like this on your functions.php:

add_action('init', 'remove_unnecessary_capabilities', 10);
function remove_unnecessary_capabilities() {
    $caps_to_remove = array(
        'switch_themes' // etc
    $custom_role = get_role('admin_editor'); // Edit according to your role as it was declared when added
    foreach($caps_to_remove as $cap) {

The code above will run every time a page is rendered, though the capabilities are recorded in the database. This doesn't have any consequence other than adding unnecessary overhead, but if it bothers you, check the following answers: this, if you're coding a theme; or this if you're coding a plugin.

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.