Wordpress - Restrict access to plugin only

扶醉桌前 提交于 2019-12-10 11:22:49

问题


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.


回答1:


You can make the menu of the plugin available to the user level's capability. As you can see in WordPress codex,

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.

Here's a complete list of capabilities.



来源:https://stackoverflow.com/questions/5453196/wordpress-restrict-access-to-plugin-only

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!