mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-01 11:14:36 +00:00
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:
@@ -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' ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user