Make WordPress Core

Ticket #5809: 5809-2.diff

File 5809-2.diff, 963 bytes (added by greuben, 14 years ago)
  • wp-includes/taxonomy.php

     
    22702270                else
    22712271                        return new WP_Error('duplicate_term_slug', sprintf(__('The slug “%s” is already in use by another term'), $slug));
    22722272        }
     2273       
     2274        if( $wpdb->get_var( $wpdb->prepare( "SELECT term_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy != %s", $id, $taxonomy ) ) ) {
     2275                $slug = wp_unique_term_slug( $slug, (object)$args );   
     2276                $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) );
     2277                $term_id = ( int ) $wpdb->insert_id;
     2278                $wpdb->update( $wpdb->term_taxonomy, compact( 'term_id' ), array( 'term_id' => $id, 'taxonomy' => $taxonomy ) );               
     2279        }
     2280       
    22732281        do_action( 'edit_terms', $term_id );
    22742282        $wpdb->update($wpdb->terms, compact( 'name', 'slug', 'term_group' ), compact( 'term_id' ) );
    22752283        if ( empty($slug) ) {