I have this variable:
$wpll_accesslist = self::$options['wpll_settings']['wpll_accesslist'];
and it's output is:
Array
(
[Author] => 1
[Contributor] => 1
[Shop_Manager] => 1
[Customer] => 1
)
These Author, Contributor, Shop_Manager, Customer is roles. Now, I want to add new capability called wpll_caps to these roles.
What I am doing for this:
foreach($wpll_accesslist as $key => $value) {
// get the the role object
$role_object = get_role( strtolower($key) );
// add wpll_caps capability to this role object
$role_object->add_cap( 'wpll_caps' );
}
but it's not working. Am I missing something?