WordPress.org

Ready to get started?Download WordPress

Review WordPress Themes

Tagged: 3.2 Toggle Comment Threads | Keyboard Shortcuts

  • Chip Bennett 2:43 pm on July 1, 2011 Permalink
    Tags: 3.2, ,   

    WordPress 3.2: Fixing the edit_theme_options/manage_options bug 

    Theme Developers:

    Many of you are aware of a minor bug in the Settings API implementation for Themes, in which add_theme_page() is passed the “edit_theme_options” capability, but the settings form submission via options.php requires the “manage_options” capability, resulting in users with the Editor role having access to the settings page, but being unable to submit the settings page form.

    Fortunately, WordPress 3.2 adds a new filter that can be used to resolve this issue: option_page_capability_{option_page}, where {option_page} is the name of the option page, as defined in the fourth parameter passed to add_theme_page().

    To get an idea of how to implement the fix, refer to the patch for the filter, which also includes an implemented fix for TwentyEleven. The key is to ensure that the capability passed to the hook is the same as the capability passed to add_theme_page.

    Here’s one example of how to implement:

    First, create a function to return the “edit_theme_options”:

    function themeslug_get_options_page_cap() {
        return 'edit_theme_options';
    }

    Then, hook the function:

    add_filter( 'option_page_capability_themeslug-options', 'themeslug_get_options_page_cap' );

    Then, ensure consistency with the add_theme_page() call. Notice that I replace the hard-coded string with the previously defined function:

    add_theme_page(
        'Theme Name Options',
        'Theme Name Options',
        themeslug_get_options_page_cap(),
        'themeslug-options',
        'themeslug_callback_function'
    );

    If you’re already testing against the 3.2 Release Candidate (and you are, aren’t you?), you should now be able to save Theme settings as a user with the Editor role.

     
    • Carl 9:44 am on October 27, 2011 Permalink

      The variable {option_page} in the filter option_page_capability_{option_page} should not be the fourth parameter from the add_theme_page call.

      Rather, it must be the same as the intended settings group that is to be modified. Clarification: the first parameter when doing register_setting(‘settings-group’, ‘setting’);

      For many these are set alike but that might not always be the case.

  • Chip Bennett 9:28 pm on May 16, 2011 Permalink
    Tags: 3.2, jquery   

    Important information for Theme developers regarding jQuery changes in WordPress 3.2. If you use jQuery, please read!

     
  • Chip Bennett 11:38 am on May 12, 2011 Permalink
    Tags: 3.2   

    Theme reviewers and developers: WordPress 3.2 Beta 1 is upon us.

    Reviewers, now is the time to switch your test environments to the beta (e.g. using the WordPress Beta Tester Plugin), and to start identifying any potential changes to the Guidelines based on the 3.2 release. (There shouldn’t be many this cycle.)

    Developers: now is a great time to switch your development environments to the beta (e.g. using the WordPress Beta Tester Plugin), to start working out any issues that might be introduced in the new code.

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel