Make WordPress Core


Ignore:
Timestamp:
10/16/2015 09:41:51 PM (9 years ago)
Author:
boonebgorges
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/term/getTerm.php

    r35225 r35227  
    107107        $this->assertInternalType( 'int', $found->term_group );
    108108    }
     109
     110    /**
     111     * @ticket 34332
     112     */
     113     public function test_should_return_null_when_provided_taxonomy_does_not_match_actual_term_taxonomy() {
     114        $term_id = self::$factory->term->create( array( 'taxonomy' => 'post_tag' ) );
     115        $this->assertNull( get_term( $term_id, 'category' ) );
     116    }
    109117}
Note: See TracChangeset for help on using the changeset viewer.