I have created a plugin, but it seems that all roles (Contributor, Author, Editor, Admin) except Subscriber have access to the settings/options page for my plugin.

How do I set permissions for only Admin to be able to access my plugin options/settings page?

EDIT: Here is how I create the options page:

function myplugin_add_admin_settings_menu() {
  add_options_page( 'MyPlugin Options', 'MyPlugin Options', 'read', 'myplugin-options', 'myplugin_options' );
add_action( 'admin_menu', 'myplugin_add_admin_settings_menu' );

function myplugin_options() {
  //Display options/settings page here
  • show us how you create this setting page
    – mmm
    Commented Jul 31, 2016 at 7:40
  • @mmm I have added details on how I create the page above. Thxs
    – jsherk
    Commented Jul 31, 2016 at 12:22

1 Answer 1


The 3rd argument of add_options_page is the capability required for this page to be displayed to the user.

Then to allow only admin to use this page, you have to set a capability which is only owned by admin, like activate_plugins.

So change read to activate_plugins like this:

add_options_page( 'MyPlugin Options', 'MyPlugin Options', 'activate_plugins', 'myplugin-options', 'myplugin_options' );
  • If you add a piece of code as example, your answer would be complete.
    – cybmeta
    Commented Jul 31, 2016 at 16:13
  • juste change "read" in your code by "activate_plugins"
    – mmm
    Commented Jul 31, 2016 at 18:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.