WordPress.org

Make WordPress Core

Ticket #20832: 20832.diff

File 20832.diff, 1001 bytes (added by duck_, 23 months ago)
  • wp-includes/taxonomy.php

     
    22272227 * If that still doesn't return an unique slug, then it try to append a number 
    22282228 * until it finds a number that is truly unique. 
    22292229 * 
    2230  * The only purpose for $term is for appending a parent, if one exists. 
    2231  * 
    22322230 * @package WordPress 
    22332231 * @subpackage Taxonomy 
    22342232 * @since 2.3.0 
     
    22632261        } 
    22642262 
    22652263        // If we didn't get a unique slug, try appending a number to make it unique. 
    2266         if ( !empty($args['term_id']) ) 
    2267                 $query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s AND term_id != %d", $slug, $args['term_id'] ); 
     2264        if ( ! empty( $term->term_id ) ) 
     2265                $query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s AND term_id != %d", $slug, $term->term_id ); 
    22682266        else 
    22692267                $query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s", $slug ); 
    22702268