Changeset 38500
- Timestamp:
- 09/01/2016 04:50:47 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-term-query.php
r38377 r38500 774 774 $orderby = 't.slug'; 775 775 } elseif ( 'include' == $_orderby && ! empty( $this->query_vars['include'] ) ) { 776 $include = implode( ',', array_map( 'absint',$this->query_vars['include'] ) );776 $include = implode( ',', wp_parse_id_list( $this->query_vars['include'] ) ); 777 777 $orderby = "FIELD( t.term_id, $include )"; 778 778 } elseif ( 'term_group' == $_orderby ) { -
trunk/tests/phpunit/tests/term/query.php
r38211 r38500 166 166 $this->assertNotEmpty( $q2->terms ); 167 167 } 168 169 /** 170 * @ticket 23261 171 * @ticket 37904 172 */ 173 public function test_orderby_include_with_comma_separated_list() { 174 register_taxonomy( 'wptests_tax_1', 'post' ); 175 176 $t1 = self::factory()->term->create_and_get( array( 'taxonomy' => 'wptests_tax_1' ) ); 177 $t2 = self::factory()->term->create_and_get( array( 'taxonomy' => 'wptests_tax_1' ) ); 178 179 $query = new WP_Term_Query( array( 180 'include' => "{$t1->term_id},{$t2->term_id}", 181 'orderby' => 'include', 182 'hide_empty' => false, 183 ) ); 184 $terms = $query->get_terms(); 185 186 $this->assertEquals( array( $t1, $t2 ), $terms ); 187 } 168 188 }
Note: See TracChangeset
for help on using the changeset viewer.