Purpose of Adding Capability to Role But Not Grant?

I am attempting to create a custom role upon activation of my plugin. Along with that role, I wanted to add new capability to that role to access later. Now, after reading the Codex, I am totally confused. What is the purpose of the grant parameter? What good would it do to add a capability to a user/role and not grant access to it when WordPress doesn’t offer access to check if the capability is granted? The has_cap method only returns true or false.

At this point, it looks like the direction I should go is just create new Roles and either assign those roles to my users or not. The capabilities were going to be a “neat” way of me adding the custom capabilities without cluttering up the role list when manually adding a user. It looks like this won’t work for me. Anyone confirm what I am reading/finding?

Related posts

Leave a Reply