WordPress – Restrict access to plugin only

Mar 13, 2012   //   by phpfreelancer.biz   //   Blog, Wordpress Plugin Tutorial  //  No Comments

I have created a plugin using WordPress and I would like to create a user account that ONLY has access to this plugin. In other words when the user logs in to the wordpress admin panel this plugin is the only thing they see.

You can make the menu of the plugin available to the user level’s capability.

add_options_page('My Plugin Options', 'My Plugin', 'manage_options', 'my-unique-identifier', 'my_plugin_options');

‘manage_options’ is a capability of an administrator. A subscriber’s capability is ‘read’, so replace ‘manage_options’ with ‘read’ and you’ll give access to the subscriber.

This not only works with add_option_page, but also with add_menu_page, add_plugins_page, etc.

Leave a comment

Share This Post

RSS Wordpress News

  • The WordPress.com Year in Review (and Resolutions for 2018) January 3, 2018
    It was quite a year for the WordPress.com community, and we've got a lot to look forward to.
  • Managing Your Blog On a Mobile Device December 13, 2017
    A few enhancements we've added to the iOS and Android apps for easier blogging.
  • New Premium Themes: Small Business and Photo Blog December 7, 2017
    Introducing two new premium themes: Small Business, made for your entrepreneurial endeavors, and Photo Blog, designed to make your photography shine.
  • Updated Privacy Policy December 4, 2017
    As part of our commitment to privacy and transparency, we’re updating our Privacy Policy. We want to give you more information about how we collect and use personal information — in a more organized and readable format. “Your privacy is critically important to us.” These are the first words of …
  • Update Your Avatar on WordPress.com October 12, 2017
    Manage, upload, and edit your profile photo at wordpress.com/me.
  • A New Media Picker for the iOS WordPress App October 9, 2017
    Sometimes it’s the extra touches that make all the difference; on your website, that’s the photos and video that give your content life. You asked for streamlined access to your media library and the camera and photos on your device, to make uploading and inserting photos and videos easier. We …