Make WordPress Core


Ignore:
Timestamp:
04/02/2010 01:26:44 AM (14 years ago)
Author:
wpmuguru
Message:

rework syncing of global terms, see #12663

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/taxonomy.php

    r13924 r13925  
    15461546        // Make sure the slug is unique accross all taxonomies.
    15471547        $slug = wp_unique_term_slug($slug, (object) $args);
    1548         if ( !is_multisite() ) {
    1549             if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) )
    1550                 return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
    1551             $term_id = (int) $wpdb->insert_id;
    1552         } else {
    1553             $maxterm = $wpdb->get_var( "SELECT max(term_id) FROM {$wpdb->terms}" );
    1554             $term_id = mt_rand( $maxterm+100, $maxterm+4000 );
    1555             if ( false === $wpdb->insert( $wpdb->terms, compact( 'term_id', 'name', 'slug', 'term_group' ) ) )
    1556                 return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
    1557         }
     1548        if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) )
     1549            return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
     1550        $term_id = (int) $wpdb->insert_id;
    15581551    } else if ( is_taxonomy_hierarchical($taxonomy) && !empty($parent) ) {
    15591552        // If the taxonomy supports hierarchy and the term has a parent, make the slug unique
    15601553        // by incorporating parent slugs.
    15611554        $slug = wp_unique_term_slug($slug, (object) $args);
    1562         if ( !is_multisite() ) {
    1563             if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) )
    1564                 return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
    1565             $term_id = (int) $wpdb->insert_id;
    1566         } else {
    1567             $maxterm = $wpdb->get_var( "SELECT max(term_id) FROM {$wpdb->terms}" );
    1568             $term_id = mt_rand( $maxterm+100, $maxterm+4000 );
    1569             if ( false === $wpdb->insert( $wpdb->terms, compact( 'term_id','name', 'slug', 'term_group' ) ) )
    1570                 return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
    1571         }
     1555        if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) )
     1556            return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
     1557        $term_id = (int) $wpdb->insert_id;
    15721558    }
    15731559
Note: See TracChangeset for help on using the changeset viewer.