edit_theme_options fix #16

zslabs opened this Issue Nov 8, 2011 · 5 comments


None yet
3 participants

zslabs commented Nov 8, 2011

Hi Devin,
WordPress 3.2 has a bug that doesn't allow users of the Editor role (for example) to save the theme_options pages due to a bug in how the capabilities are figured into posting to options.php. I believe 3.3 addresses this properly. I know the Options Framework theme builds off of Twenty Eleven (which already has this fix in it), but if you add the following to options-framework.php this fixed it for me (for people building their own theme):

 * Change the capability required to save the 'twentyeleven_options' options group.
 * @see twentyeleven_theme_options_init() First parameter to register_setting() is the name of the options group.
 * @see twentyeleven_theme_options_add_page() The edit_theme_options capability is used for viewing the page.
 * By default, the options groups for all registered settings require the manage_options capability.
 * This filter is required to change our theme options page to edit_theme_options instead.
 * By default, only administrators have either of these capabilities, but the desire here is
 * to allow for finer-grained control for roles and users.
 * @param string $capability The capability used for the page, which is manage_options by default.
 * @return string The capability to actually use.
function of_option_page_capability( $capability ) {
    return 'edit_theme_options';
add_filter( 'option_page_capability_optionsframework', 'of_option_page_capability' );

devinsays commented Nov 8, 2011

Just to be clear, the bug is only when you grant someone in the "Editor" role the capability to "edit_theme_options"?

Are you using a plugin to do that, or do you have some custom code? I'll need to test it before inclusion.

3.3 should be coming out soon. Do you think it is worth adding this code if it will be fixed shortly?

zslabs commented Nov 8, 2011

Hi Devin,
Basically, the bug/issue is with anyone (other than the Administrator role) that has the ability "edit_theme_options" capability. http://make.wordpress.org/themes/2011/07/01/wordpress-3-2-fixing-the-edit_theme_optionsmanage_options-bug/ explains it a bit more (but the actual work-around that was proposed for WordPress 3.2 was included in the Twenty Eleven theme, not the one he had there).

I'm using the Members plugin http://wordpress.org/extend/plugins/members/ to grant additional capabilities.

I saw http://core.trac.wordpress.org/ticket/14365 but I'm not actually 100% if this has been implemented for 3.3 - so I wonder if this might be/should be included regardless. Thanks!


devinsays commented Feb 27, 2012

Got this in the last commit. Let me know if you have any issues with it.

@devinsays devinsays closed this Feb 27, 2012


I'm still getting the "Cheatin' huh?" error when an editor tries to save theme options. I'm using the Members plugin to add the edit_theme_options capability to the editor role - they can see the options page but not save changes. I'm using WordPress 3.3.2...

Any clues as to how I can make the theme options page available to editors?

Cheers and thanks a lot for the awesome framework!

@devinsays devinsays reopened this Apr 29, 2012


devinsays commented Apr 29, 2012

It looks like this was pulled out because the feature was fixed in WordPress. Are you using the latest version of WordPress?

Line 104:

Ensures that a user with the 'edit_theme_options' capability can actually set the options
See: http://core.trac.wordpress.org/ticket/14365

@param string $capability The capability used for the page, which is manage_options by default.
@return string The capability to actually use.

function optionsframework_page_capability( $capability ) {
return 'edit_theme_options';

@devinsays devinsays closed this Jun 24, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment