add capabilities to a wordpress role


/ Published in: PHP
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.