Support » Plugins » capability levels (am I blind?)

  • For functions like add_options_page() one of the accepted arguments is capability. The Codex page for capabilities lists specific capabilities, but not how to just say “Editors” or “Authors.” What do you pass for the capability argument if you want to give add the options page for just editors and higher?

    I feel like this must be on the Codex page and I am just having a blind spell.

    Thanks!

Viewing 1 replies (of 1 total)
  • esmi

    (@esmi)

    Forum Moderator

    Pick an existing capability that extends to Editors and above and use that. For example:

    // Add theme options page
    function etheme_options_add_page() {
    	add_theme_page( __( 'Theme Options', 'purplepastels' ), __( 'Theme Options', 'purplepastels' ), 'edit_theme_options', 'etheme_options', 'etheme_options_do_page' );
    }
    add_action('admin_menu', 'etheme_options_add_page');

    I’ve used edit_theme_options as the capability. The full list of capabilities per role are listed on Roles_and_Capabilities.

Viewing 1 replies (of 1 total)
  • The topic ‘capability levels (am I blind?)’ is closed to new replies.