Posted By

errkk on 09/10/10


Tagged

wordpress capabilities roles


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

lgarcia
laurentzziu


add capabilities to a wordpress role


 / Published in: PHP
 

run funciton once, ideally bind to activation hook of a plugin

  1. function update_caps()
  2. {
  3. $role = get_role( 'editor' );
  4.  
  5. $caps_to_add = array(
  6. 'delete_users',
  7. 'create_users',
  8. 'list_users',
  9. 'remove_users',
  10. 'add_users',
  11. 'promote_users',
  12. );
  13.  
  14.  
  15.  
  16. foreach( $caps_to_add as $cap )
  17. $role->add_cap( $cap );
  18.  
  19. }

Report this snippet  

You need to login to post a comment.