How to update role capabilities

Question

I have manually created a role called “event-planner”. I’ve assigned some capabilities to it and it works as expected. However, if I later set one of the capabilities from true to false (or viceversa), changes won’t reflect in WordPress. I think this is related to WordPress not updating the capabilities because if I delete the role and then add the code again, then it will work.

Is there a way to “tell” WordPress to update my role capabilities once they were set?

Here is my code:

$result = add_role( 'event-planner', __(

'Event Planner' ),

array(

'read' => true,     
'delete_others_events' => false, 
'delete_private_events' => true,
'delete_published_events' => true, 
'delete_events' => true, 
'edit_others_events' => false, 
'edit_private_events' => true, 
'edit_published_events' => true, 
'edit_events' => true,
'publish_events' => true, 
'read_private_events' => true


)

);
0
Johann 2 years 2020-12-15T09:10:34-05:00 0 Answers 6 views 0

Leave an answer

Browse
Browse