Index: /trunk/src/bp-core/bp-core-taxonomy.php
===================================================================
--- /trunk/src/bp-core/bp-core-taxonomy.php	(revision 12726)
+++ /trunk/src/bp-core/bp-core-taxonomy.php	(revision 12727)
@@ -278,2 +278,200 @@
 	return $term;
 }
+
+/**
+ * Add a new taxonomy term to the database.
+ *
+ * @since 7.0.0
+ *
+ * @param string $term     The BP term name to add.
+ * @param string $taxonomy The BP taxonomy to which to add the BP term.
+ * @param array  $args {
+ *     Optional. Array of arguments for inserting a BP term.
+ *     @type string $description The term description. Default empty string.
+ *     @type string $slug        The term slug to use. Default empty string.
+ *     @type array  $metas       The term metas to add. Default empty array.
+ * }
+ * @return array|WP_Error An array containing the `term_id` and `term_taxonomy_id`,
+ *                        WP_Error otherwise.
+ */
+function bp_insert_term( $term, $taxonomy = '', $args = array() ) {
+	if ( ! taxonomy_exists( $taxonomy ) ) {
+		return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.', 'buddypress' ) );
+	}
+
+	$site_id = bp_get_taxonomy_term_site_id( $taxonomy );
+
+	$switched = false;
+	if ( $site_id !== get_current_blog_id() ) {
+		switch_to_blog( $site_id );
+		bp_register_taxonomies();
+		$switched = true;
+	}
+
+	$term_metas = array();
+	if ( isset( $args['metas'] ) ) {
+		$term_metas = (array) $args['metas'];
+		unset( $args['metas'] );
+	}
+
+	/**
+	 * Fires before a BP Term is added to the database.
+	 *
+	 * @since 7.0.0
+	 *
+	 * @param string $term     The BP term name to add.
+	 * @param string $taxonomy The BP taxonomy to which to add the term.
+	 * @param array  $args     Array of arguments for inserting a BP term.
+	 */
+	do_action( 'bp_before_insert_term', $term, $taxonomy, $args );
+
+	$tt_id = wp_insert_term( $term, $taxonomy, $args );
+
+	if ( is_wp_error( $tt_id ) ) {
+		return $tt_id;
+	}
+
+	$term_id = reset( $tt_id );
+
+	if ( $term_metas ) {
+		bp_update_type_metadata( $term_id, $taxonomy, $term_metas );
+	}
+
+	if ( $switched ) {
+		restore_current_blog();
+	}
+
+	/**
+	 * Fires when taxonomy terms have been set on BuddyPress objects.
+	 *
+	 * @since 7.0.0
+	 *
+	 * @param array  $tt_ids    An array containing the `term_id` and `term_taxonomy_id`.
+	 * @param string $taxonomy  Taxonomy name.
+	 * @param array  $term_metas The term metadata.
+	 */
+	do_action( 'bp_insert_term', $tt_id, $taxonomy, $term_metas );
+
+	return $tt_id;
+}
+
+/**
+ * Get taxonomy BP Terms from the database.
+ *
+ * @since 7.0.0
+ *
+ * @param array  $args {
+ *     Array of arguments to query BP Terms.
+ *     @see `get_terms()` for full description of arguments in case of a member type.
+ * }
+ * @return array The list of terms matching arguments.
+ */
+function bp_get_terms( $args = array() ) {
+	$args = bp_parse_args(
+		$args,
+		array(
+			'taxonomy'   => '',
+			'number'     => '',
+			'hide_empty' => false,
+		),
+		'get_terms'
+	);
+
+	if ( ! $args['taxonomy'] ) {
+		return array();
+	}
+
+	$site_id = bp_get_taxonomy_term_site_id( $args['taxonomy'] );
+
+	$switched = false;
+	if ( $site_id !== get_current_blog_id() ) {
+		switch_to_blog( $site_id );
+		bp_register_taxonomies();
+		$switched = true;
+	}
+
+	$terms = get_terms( $args );
+
+	if ( $switched ) {
+		restore_current_blog();
+	}
+
+	/**
+	 * Filter here to modify the BP Terms found into the database.
+	 *
+	 * @since 7.0.0
+	 *
+	 * @param array $terms The list of terms matching arguments.
+	 * @param array $args  Array of arguments used to query BP Terms.
+	 */
+	return apply_filters(
+		'bp_get_terms',
+		$terms,
+		$args
+	);
+}
+
+/**
+ * Deletes a BP Term.
+ *
+ * @since 7.0.0
+ *
+ * @param int     $term_id  The BP Term ID. Required.
+ * @param string  $taxonomy The BP Taxonomy Name. Required.
+ * @return bool|WP_Error True on success, WP_Error on failure.
+ */
+function bp_delete_term( $term_id = 0, $taxonomy = '' ) {
+	if ( ! $term_id || ! $taxonomy ) {
+		return new WP_Error( 'missing_arguments', __( 'Sorry, the term ID and the taxonomy are required arguments.', 'buddypress' ) );
+	}
+
+	$site_id = bp_get_taxonomy_term_site_id( $taxonomy );
+
+	$switched = false;
+	if ( $site_id !== get_current_blog_id() ) {
+		switch_to_blog( $site_id );
+		bp_register_taxonomies();
+		$switched = true;
+	}
+
+	/**
+	 * Fires before a BP Term is deleted from the database.
+	 *
+	 * @since 7.0.0
+	 *
+	 * @param int    $term_id  The BP Term ID.
+	 * @param string $taxonomy The BP Taxonomy Name.
+	 */
+	do_action( 'bp_before_delete_term', $term_id, $taxonomy );
+
+	$deleted = wp_delete_term( $term_id, $taxonomy );
+
+	if ( $switched ) {
+		restore_current_blog();
+	}
+
+	if ( is_wp_error( $deleted ) ) {
+		return $deleted;
+	}
+
+	if ( false === $deleted ) {
+		return new WP_Error( 'inexistant_term', __( 'Sorry, the term does not exist.', 'buddypress' ) );
+	}
+
+	if ( 0 === $deleted ) {
+		return new WP_Error( 'default_term', __( 'Sorry, the default term cannot be deleted.', 'buddypress' ) );
+	}
+
+	/**
+	 * Fires once a BP Term has been deleted from the database.
+	 *
+	 * @since 7.0.0
+	 *
+	 * @param boolean $deleted True.
+	 * @param int     $term_id  The deleted BP Term ID.
+	 * @param string  $taxonomy The BP Taxonomy Name of the deleted BP Term ID.
+	 */
+	do_action( 'bp_delete_term', $deleted, $term_id, $taxonomy );
+
+	return $deleted;
+}
