bp_remove_object_terms( int $object_id, string|array $terms, string $taxonomy )

Remove taxonomy terms on a BuddyPress object.


Description Description

See also See also


Top ↑

Parameters Parameters

$object_id

(Required) Object ID.

$terms

(Required) Term or terms to remove.

$taxonomy

(Required) Taxonomy name.


Top ↑

Return Return

(bool|WP_Error) True on success, false or WP_Error on failure.


Top ↑

Source Source

File: bp-core/bp-core-taxonomy.php

function bp_remove_object_terms( $object_id, $terms, $taxonomy ) {
	$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;
	}

	$retval = wp_remove_object_terms( $object_id, $terms, $taxonomy );

	if ( $switched ) {
		restore_current_blog();
	}

	/**
	 * Fires when taxonomy terms have been removed from BuddyPress objects.
	 *
	 * @since 2.7.0
	 *
	 * @param int    $object_id Object ID.
	 * @param array  $terms     Term or terms to remove.
	 * @param string $taxonomy  Taxonomy name.
	 */
	do_action( 'bp_remove_object_terms', $object_id, $terms, $taxonomy );

	return $retval;
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.3.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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