diff --git src/wp-includes/taxonomy.php src/wp-includes/taxonomy.php
index 1db44dc..6db0f20 100644
|
|
|
function wp_update_term( $term_id, $taxonomy, $args = array() ) {
|
| 3539 | 3539 | return new WP_Error('duplicate_term_slug', sprintf(__('The slug “%s” is already in use by another term'), $slug)); |
| 3540 | 3540 | } |
| 3541 | 3541 | |
| 3542 | | $tt_id = $wpdb->get_var( $wpdb->prepare( "SELECT tt.term_taxonomy_id FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id = %d", $taxonomy, $term_id) ); |
| | 3542 | $tt_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT tt.term_taxonomy_id FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id = %d", $taxonomy, $term_id) ); |
| 3543 | 3543 | |
| 3544 | 3544 | // Check whether this is a shared term that needs splitting. |
| 3545 | 3545 | $_term_id = _split_shared_term( $term_id, $tt_id ); |
diff --git tests/phpunit/tests/term/wpUpdateTerm.php tests/phpunit/tests/term/wpUpdateTerm.php
index 9213de5..47ec569 100644
|
|
|
class Tests_Term_WpUpdateTerm extends WP_UnitTestCase {
|
| 472 | 472 | $this->assertEquals( $term_by_id, $term_by_ttid ); |
| 473 | 473 | } |
| 474 | 474 | |
| | 475 | /** |
| | 476 | * @ticket 32876 |
| | 477 | */ |
| | 478 | public function test_wp_update_term_should_return_int_values_for_term_id_and_term_taxonomy_id() { |
| | 479 | register_taxonomy( 'wptests_tax', 'post' ); |
| | 480 | $t = $this->factory->term->create( array( |
| | 481 | 'taxonomy' => 'wptests_tax', |
| | 482 | ) ); |
| | 483 | $found = wp_update_term( $t, 'wptests_tax', array( |
| | 484 | 'slug' => 'foo', |
| | 485 | ) ); |
| | 486 | |
| | 487 | $this->assertInternalType( 'int', $found['term_id'] ); |
| | 488 | $this->assertInternalType( 'int', $found['term_taxonomy_id'] ); |
| | 489 | } |
| | 490 | |
| 475 | 491 | public function test_wp_update_term_should_clean_object_term_cache() { |
| 476 | 492 | register_taxonomy( 'wptests_tax_for_post', 'post' ); |
| 477 | 493 | register_taxonomy( 'wptests_tax_for_page', 'page' ); |