mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-12-06 20:58:55 +00:00
Don't require explicit taxonomy when getting terms by term_taxonomy_id.
Props wonderboymusic. Fixes #30620. git-svn-id: https://develop.svn.wordpress.org/trunk@34679 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -36,4 +36,27 @@ class Tests_Term_GetTermBy extends WP_UnitTestCase {
|
||||
$found = get_term_by( 'slug', 'nas', 'wptests_tax' );
|
||||
$this->assertSame( $t, $found->term_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 30620
|
||||
*/
|
||||
public function test_taxonomy_should_be_ignored_if_matching_by_term_taxonomy_id() {
|
||||
global $wpdb;
|
||||
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
$t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
|
||||
$term = get_term( $t, 'wptests_tax' );
|
||||
|
||||
$new_ttid = $term->term_taxonomy_id + 1;
|
||||
|
||||
// Offset just to be sure.
|
||||
$wpdb->update(
|
||||
$wpdb->term_taxonomy,
|
||||
array( 'term_taxonomy_id' => $new_ttid ),
|
||||
array( 'term_id' => $t )
|
||||
);
|
||||
|
||||
$found = get_term_by( 'term_taxonomy_id', $new_ttid, 'foo' );
|
||||
$this->assertSame( $t, $found->term_id );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user