A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

Hot answers tagged

1

The best place to add this would be in the plugin's activation hook. You can either call the dynamic activate_{$plugin} hook, or better yet use the provided register_activation_hook method. Using your code example above - something like this would be what you're looking for: register_activation_hook( __FILE__, function() { $role = get_role( 'editor' );...


Only top voted, non community-wiki answers of a minimum length are eligible