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