Theme option editing capability problems

I’ve setup some theme options using this helpful guide as a template. I want to give my editors the option to update these theme options, so I granted the edit_theme_options capability as mentioned here.

However when logged in as an editor I can see the options page, but when I go to save it I get the ‘Cheatin uh?’ message. I checked the wp-admin/options.php page and the code is:

Read More
if ( !current_user_can('manage_options') )
wp_die(__('Cheatin’ uh?'));

So it seems you can’t edit options without the manage_options capability, which makes sense. It makes me wonder how you differentiate between general options and theme options. Is there something I’ve missed?

Related posts

Leave a Reply

1 comment

  1. You should be posting your data (via <form action="" ...> to your theme options page, rather than to the wp-admin/options.php file. The latter is for the stuff under Settings.

    Also, I don’t mean to be tossing dirt at anyone in particular, but always take the tips that you read on the web with a grain of salt. This post on the same site, as an example, offers extremely bad advice:

    http://themeshaper.com/customize-blog-posts-touching-theme-files/

    function myblog_shareontwitter($content) {
    
        print $content; ?>
    
        <p><a href="http://twitter.com/home?status=Currently reading <?php the_permalink(); ?>" title="Click to send this page to Twitter!" target="_blank">Share <em><?php the_title() ?></em> on Twitter</a></p>
    
    <?php }
    add_filter('the_content', 'myblog_shareontwitter');
    

    The above code is completely broken: “the_content” is a filter, WP expects $content to be returned rather than echoed, and WP (not to mention plugins) expect $content to still be around after that function gets called. Moreover, the_title() will return garbage if you’re not in the loop; this is problematic in that automatically generating an excerpt outside of the loop will call “the_content”.