Make WordPress Core

Ticket #18609: global_terms_auto_update_replacement.diff

File global_terms_auto_update_replacement.diff, 954 bytes (added by purcebr, 11 years ago)
  • wp-includes/ms-functions.php

     
    18151815                if ( get_option( 'default_category' ) == $term_id )
    18161816                        update_option( 'default_category', $global_id );
    18171817
    1818                 $wpdb->update( $wpdb->terms, array('term_id' => $global_id), array('term_id' => $term_id) );
     1818                $replacement_term = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->terms WHERE term_id = %d", $term_id ), ARRAY_A );
     1819
     1820                $wpdb->delete( $wpdb->terms, array('term_id' => $replacement_term['term_id'] ) );
     1821                $replacement_term['term_id'] = $global_id;
     1822                $wpdb->insert( $wpdb->terms, $replacement_term );
     1823
    18191824                $wpdb->update( $wpdb->term_taxonomy, array('term_id' => $global_id), array('term_id' => $term_id) );
    18201825                $wpdb->update( $wpdb->term_taxonomy, array('parent' => $global_id), array('parent' => $term_id) );
    18211826