mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 21:08:44 +01:00
Taxononmy: Set WP_Term_Query::terms
when returning terms from the cache in WP_Term_Query::get_terms()
.
Merge of [38211] and [38212] to the 4.6 branch. Props wonderboymusic. Props boonebgorges for review. Fixes #37591. git-svn-id: https://develop.svn.wordpress.org/branches/4.6@38214 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
692c93bc39
commit
d3f17e6dbc
@ -641,7 +641,8 @@ class WP_Term_Query {
|
||||
$cache = array_map( 'get_term', $cache );
|
||||
}
|
||||
|
||||
return $cache;
|
||||
$this->terms = $cache;
|
||||
return $this->terms;
|
||||
}
|
||||
|
||||
if ( 'count' == $_fields ) {
|
||||
|
@ -142,4 +142,27 @@ class Tests_Term_Query extends WP_UnitTestCase {
|
||||
$clauses['orderby'] = 'ORDER BY tt.term_id';
|
||||
return $clauses;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 37591
|
||||
*/
|
||||
public function test_terms_is_set() {
|
||||
register_taxonomy( 'wptests_tax_1', 'post' );
|
||||
|
||||
self::factory()->term->create( array( 'taxonomy' => 'wptests_tax_1' ) );
|
||||
|
||||
$q1 = new WP_Term_Query( array(
|
||||
'taxonomy' => 'wptests_tax_1',
|
||||
'hide_empty' => false
|
||||
) );
|
||||
|
||||
$this->assertNotEmpty( $q1->terms );
|
||||
|
||||
$q2 = new WP_Term_Query( array(
|
||||
'taxonomy' => 'wptests_tax_1',
|
||||
'hide_empty' => false
|
||||
) );
|
||||
|
||||
$this->assertNotEmpty( $q2->terms );
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user