Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/03/2015 08:01:25 PM (10 years ago)
Author:
boonebgorges
Message:

Introduce bp_remove_object_terms() wrapper, and use in bp_remove_member_type().

Props Mamaduka.
Fixes #6188.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-taxonomy.php

    r9519 r9589  
    8080    return $retval;
    8181}
     82
     83/**
     84 * Remove taxonomy terms on a BuddyPress object.
     85 *
     86 * @since BuddyPress (2.3.0)
     87 *
     88 * @see wp_remove_object_terms() for a full description of function and parameters.
     89 *
     90 * @param int          $object_id Object ID.
     91 * @param string|array $terms     Term or terms to remove.
     92 * @param string       $taxonomy  Taxonomy name.
     93 * @return bool|WP_Error True on success, false or WP_Error on failure.
     94 */
     95function bp_remove_object_terms( $object_id, $terms, $taxonomy ) {
     96    $is_root_blog = bp_is_root_blog();
     97
     98    if ( ! $is_root_blog ) {
     99        switch_to_blog( bp_get_root_blog_id() );
     100    }
     101
     102    $retval = wp_remove_object_terms( $object_id, $terms, $taxonomy );
     103
     104    if ( ! $is_root_blog ) {
     105        restore_current_blog();
     106    }
     107
     108    return $retval;
     109}
Note: See TracChangeset for help on using the changeset viewer.