Make WordPress Core

Ticket #18609: 18609.diff

File 18609.diff, 977 bytes (added by peterwilsoncc, 3 years ago)
  • src/wp-includes/ms-functions.php

    diff --git a/src/wp-includes/ms-functions.php b/src/wp-includes/ms-functions.php
    index 364b7a4cc5..4c56d37b4b 100644
    a b function global_terms( $term_id, $deprecated = '' ) { 
    21272127                        update_option( 'default_category', $global_id );
    21282128                }
    21292129
    2130                 $wpdb->update( $wpdb->terms, array( 'term_id' => $global_id ), array( 'term_id' => $term_id ) );
     2130                if ( $global_id < $max_local_id ) {
     2131                        $wpdb->update( $wpdb->terms, array( 'term_id' => $global_id ), array( 'term_id' => $term_id ) );
     2132                } else {
     2133                        $wpdb->delete( $wpdb->terms, array( 'term_id' => $term_id ) );
     2134                        $c            = (array) $c;
     2135                        $c['term_id'] = $global_id;
     2136                        $wpdb->insert( $wpdb->terms, $c );
     2137                }
     2138
    21312139                $wpdb->update( $wpdb->term_taxonomy, array( 'term_id' => $global_id ), array( 'term_id' => $term_id ) );
    21322140                $wpdb->update( $wpdb->term_taxonomy, array( 'parent' => $global_id ), array( 'parent' => $term_id ) );
    21332141