Proper use of option_page_capability_{$page_name}

I am having trouble giving access to an options page to Editors. I am pretty sure I need to use the filter option_page_capability_{$page_name} but it is not working for me. Is there a specific place to hook this? I am still getting the Cheatin', uh? error with this:

    function bf_ins_capability(){
        return 'edit_posts';
    }

    add_filter( 'option_page_capability_brightfire-insurance-settings', 'bf_ins_capability' );

Related posts

1 comment

  1. So in this hook is not exactly looking for the {$page_name}. Once I replaced the {$page_name} part of this filter to the {$option_group} parameter from my register_settings() function, all is well in the land of WordPress. Here is what my update needed to look like.

    function bf_ins_capability(){
      return 'edit_posts';
    }
    
    add_filter( 'option_page_capability_bf_insurance_settings', 'bf_ins_capability');
    

Comments are closed.