I'm looking to have a category created for each BuddyPress Group when it's made. So far I've found this code which would create a Category once the Group was created. I would use this code in the Theme Functions.
function example_insert_category() {
wp_insert_term(
'Example Category Name',
'category',
array(
'description' => 'This is an example category.',
'slug' => 'example-category-slug'
)
);
}
add_action('groups_group_create_complete', 'example_insert_category');
Firstly am I on the right track. Secondly how would I set the Category Name and Category Slug using the newly created Group Name and Group Slug?
Any help would be appreciated