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

Remove taxonomy terms on a BuddyPress object.

Description

See also

Parameters

$object_id

(Required) Object ID.

$terms

(Required) Term or terms to remove.

$taxonomy

(Required) Taxonomy name.

Return

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

Source

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

173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
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 BuddyPress 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;
}

Changelog

Changelog
Version Description
BuddyPress 2.3.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.