Skip to:
Content

BuddyPress.org

Changeset 9520


Ignore:
Timestamp:
02/20/2015 06:48:40 PM (10 years ago)
Author:
boonebgorges
Message:

In taxonomy functions, don't restore_current_blog() when not necessary.

Fixes #6240.

File:
1 edited

Legend:

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

    r9210 r9520  
    3838 */
    3939function bp_set_object_terms( $object_id, $terms, $taxonomy, $append = false ) {
    40     if ( ! bp_is_root_blog() ) {
     40    $is_root_blog = bp_is_root_blog();
     41
     42    if ( ! $is_root_blog ) {
    4143        switch_to_blog( bp_get_root_blog_id() );
    4244    }
     
    4446    $retval = wp_set_object_terms( $object_id, $terms, $taxonomy, $append );
    4547
    46     restore_current_blog();
     48    if ( ! $is_root_blog ) {
     49        restore_current_blog();
     50    }
    4751
    4852    return $retval;
     
    6266 */
    6367function bp_get_object_terms( $object_ids, $taxonomies, $args = array() ) {
    64     if ( ! bp_is_root_blog() ) {
     68    $is_root_blog = bp_is_root_blog();
     69
     70    if ( ! $is_root_blog ) {
    6571        switch_to_blog( bp_get_root_blog_id() );
    6672    }
     
    6874    $retval = wp_get_object_terms( $object_ids, $taxonomies, $args );
    6975
    70     restore_current_blog();
     76    if ( ! $is_root_blog ) {
     77        restore_current_blog();
     78    }
    7179
    7280    return $retval;
Note: See TracChangeset for help on using the changeset viewer.