mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Taxonomy: Ignore cached term value when it doesn't match the queried taxonomy.
When a cache entry is found that matches the requested `$term_id`, but doesn't match an explicitly provided `$taxonomy`, that cache entry should be ignored. Props GunGeekATX. Fixes #40671. git-svn-id: https://develop.svn.wordpress.org/trunk@40979 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -68,4 +68,19 @@ class Tests_Term_WpTerm extends WP_UnitTestCase {
|
||||
|
||||
$this->assertSame( 1, $found->term_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 40671
|
||||
*/
|
||||
public function test_get_instance_should_respect_taxonomy_when_term_id_is_found_in_cache() {
|
||||
global $wpdb;
|
||||
|
||||
register_taxonomy( 'wptests_tax2', 'post' );
|
||||
|
||||
// Ensure that cache is primed.
|
||||
WP_Term::get_instance( self::$term_id, 'wptests_tax' );
|
||||
|
||||
$found = WP_Term::get_instance( self::$term_id, 'wptests_tax2' );
|
||||
$this->assertFalse( $found );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user