I'm having a little difficulties with roles and capabilities.

Editors gets a 'Cheatin uh?'-message when they try to update the custom theme-settings. Can anyone explain why - or maybe even have a solution?

add_action('admin_menu', 'add_global_custom_options');
function add_global_custom_options() {
add_menu_page('Indstillinger', 'Indstillinger', 'moderate_comments', 'functions','global_custom_options');

add_action('admin_init', 'custom_settings_css');
function custom_settings_css() {
wp_enqueue_style('custom-settings-css', get_bloginfo('template_directory') . '/theme-files/css/custom-settings.css');
} ?>

function global_custom_options()
<div class="wrap theme-options">
    <form method="post" action="options.php">
        <?php wp_nonce_field('update-options') ?>

        <div class="section">
                <textarea name="box1" size="45"><?php echo get_option('box1'); ?></textarea>

        <p><input type="submit" name="Submit" value="Gem indstillinger" /></p>
        <input type="hidden" name="action" value="update" />
        <input type="hidden" name="page_options" value="box1" />

1 Answer 1


There is a capability called edit_theme_options which is by default assigned to only site admins not to editors. Check out - Roles Vs Capabilities .

To allow your editors to manage theme options you've to manually assign that capability to editors. Here to assign edit_theme_options capability to editors just drop in this code into your theme's functions.php file So editors can manage theme options page.


        function wpse61651_allow_editor() 
            $role = get_role( 'editor' ); // pick up role to edit the editor role   
            $role->add_cap( 'edit_theme_options' ); // Let them manage our theme
        add_action( 'admin_init', 'wpse61651_allow_editor');

Resource -

  • Yeah, but as far as I know this 'Add Cap'-function only allows Editors to edit the native theme-option. And not my custom theme-options. I'm thinking that i might be hooking something wrong - no? Commented Aug 13, 2012 at 12:26
  • that's not true, if your're theme's options page check for non admin users by this capability it'd work.
    – Amit Kosti
    Commented Aug 13, 2012 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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