bp_insert_group_types_registered_by_code()

Insert group types registered by code not yet saved into the database as WP Terms.


Source Source

File: bp-groups/bp-groups-functions.php

function bp_insert_group_types_registered_by_code() {
	$all_types     = bp_groups_get_group_types( array(), 'objects' );
	$unsaved_types = wp_filter_object_list( $all_types, array( 'db_id' => 0 ), 'and', 'name' );

	if ( $unsaved_types ) {
		foreach ( $unsaved_types as $type_name ) {
			bp_insert_term(
				$type_name,
				bp_get_group_type_tax_name(),
				array(
					'slug' => $type_name,
				)
			);
		}
	}
}


Top ↑

Changelog Changelog

Changelog
Version Description
7.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.