• Im making my own plugin and i looking for a plugin or a way to create custom permissions for different options on the plugin. Someone can help me?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    There are several plugins that help you manage capabilities. (to avoid confusion with file permissions, WP uses the term ‘capability’ for user rights) If a particular plugin is active on a site, your code can make use of the other plugin’s functions to manage capabilities.

    I personally would hate to develop a plugin that is dependent on another plugin (that is not even mine) to function. Especially since adding capabilities is relatively simple.

    You use the add_cap() method belonging to WP_Roles, WP_Role, or WP_User objects. You either create or get one of those objects, then call add_cap(). Function Reference/add cap

    The capability you add can be any arbitrary string as long as it is not the same as some other capability already established. A common practice is to prefix all custom capabilities with your plugin’s name or initials to help avoid possible conflicts with other plugins.

Viewing 1 replies (of 1 total)
  • The topic ‘Custom plugin permissions’ is closed to new replies.