Changeset 25106
- Timestamp:
- 08/23/2013 09:04:22 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/taxonomy.php
r24833 r25106 2381 2381 2382 2382 // If we didn't get a unique slug, try appending a number to make it unique. 2383 if ( ! empty($args['term_id']) )2384 $query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s AND term_id != %d", $slug, $ args['term_id']);2383 if ( ! empty( $term->term_id ) ) 2384 $query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s AND term_id != %d", $slug, $term->term_id ); 2385 2385 else 2386 2386 $query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s", $slug ); -
trunk/tests/tests/term.php
r25002 r25106 374 374 $this->assertEquals( 'child-neighbor-2', wp_unique_term_slug( 'child', $d_term ) ); 375 375 376 $f = wp_insert_term( 'foo', $this->taxonomy ); 377 $this->assertInternalType( 'array', $f ); 378 $f_term = get_term( $f['term_id'], $this->taxonomy ); 379 $this->assertEquals( 'foo', $f_term->slug ); 380 $this->assertEquals( 'foo', wp_unique_term_slug( 'foo', $f_term ) ); 381 382 $g = wp_insert_term( 'foo', $this->taxonomy ); 383 $this->assertInstanceOf( 'WP_Error', $g ); 384 376 385 // clean up 377 foreach ( array( $a, $b, $c, $d, $e ) as $t )386 foreach ( array( $a, $b, $c, $d, $e, $f ) as $t ) 378 387 $this->assertTrue( wp_delete_term( $t['term_id'], $this->taxonomy ) ); 379 388 }
Note: See TracChangeset
for help on using the changeset viewer.