capability levels (am I blind?) (2 posts)

  1. tirussell
    Posted 5 years ago #

    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.


  2. esmi
    Forum Moderator
    Posted 5 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic