- Timestamp:
- 08/03/2016 01:50:14 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-term-query.php
r38099 r38181 220 220 } 221 221 222 $taxonomies = isset( $query['taxonomy'] ) ? $query['taxonomy'] : null;222 $taxonomies = isset( $query['taxonomy'] ) ? (array) $query['taxonomy'] : null; 223 223 224 224 /** -
trunk/tests/phpunit/tests/term/query.php
r38099 r38181 5 5 */ 6 6 class Tests_Term_Query extends WP_UnitTestCase { 7 /** 8 * @ticket 37545 9 */ 10 public function test_taxonomy_should_accept_single_taxonomy_as_string() { 11 register_taxonomy( 'wptests_tax_1', 'post' ); 12 register_taxonomy( 'wptests_tax_2', 'post' ); 13 14 $term_1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax_1' ) ); 15 $term_2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax_2' ) ); 16 17 $q = new WP_Term_Query( array( 18 'taxonomy' => 'wptests_tax_2', 19 'fields' => 'ids', 20 'hide_empty' => false, 21 ) ); 22 23 $this->assertEqualSets( array( $term_2 ), $q->terms ); 24 } 25 26 public function test_taxonomy_should_accept_taxonomy_array() { 27 register_taxonomy( 'wptests_tax_1', 'post' ); 28 register_taxonomy( 'wptests_tax_2', 'post' ); 29 30 $term_1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax_1' ) ); 31 $term_2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax_2' ) ); 32 33 $q = new WP_Term_Query( array( 34 'taxonomy' => array( 'wptests_tax_2' ), 35 'fields' => 'ids', 36 'hide_empty' => false, 37 ) ); 38 39 $this->assertEqualSets( array( $term_2 ), $q->terms ); 40 } 41 7 42 /** 8 43 * @ticket 37074
Note: See TracChangeset
for help on using the changeset viewer.