Return null from get_term() on taxonomy mismatch.

[34997] caused `get_term()` to return an error object in the case when
`$taxonomy` did not match the taxonomy of the located term. This was an
inadvertant change from the previous behavior, when `get_term()` would return
null in these cases.

Props dlh.
See #14162. Fixes #34332.

git-svn-id: https://develop.svn.wordpress.org/trunk@35227 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2015-10-16 21:41:51 +00:00
parent 61edcd5021
commit f22ba848df
2 changed files with 10 additions and 2 deletions

View File

@@ -106,4 +106,12 @@ class Tests_Term_GetTerm extends WP_UnitTestCase {
$this->assertInternalType( 'int', $found->count );
$this->assertInternalType( 'int', $found->term_group );
}
/**
* @ticket 34332
*/
public function test_should_return_null_when_provided_taxonomy_does_not_match_actual_term_taxonomy() {
$term_id = self::$factory->term->create( array( 'taxonomy' => 'post_tag' ) );
$this->assertNull( get_term( $term_id, 'category' ) );
}
}