Changeset 30052
- Timestamp:
- 10/28/2014 06:12:30 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/taxonomy.php
r30042 r30052 1713 1713 } else if ( 'slug' == $_orderby ) { 1714 1714 $orderby = 't.slug'; 1715 } else if ( 'include' == $_orderby && ! empty( $args['include'] ) ) { 1716 $include = implode( ',', array_map( 'absint', $args['include'] ) ); 1717 $orderby = "FIELD( t.term_id, $include )"; 1715 1718 } else if ( 'term_group' == $_orderby ) { 1716 1719 $orderby = 't.term_group'; -
trunk/tests/phpunit/tests/term/getTerms.php
r30042 r30052 797 797 } 798 798 799 /** 800 * @ticket 23261 801 */ 802 public function test_orderby_include() { 803 $tax = 'wptests_tax'; 804 register_taxonomy( $tax, 'post' ); 805 806 $t1 = $this->factory->term->create( array( 'taxonomy' => $tax ) ); 807 $t2 = $this->factory->term->create( array( 'taxonomy' => $tax ) ); 808 $t3 = $this->factory->term->create( array( 'taxonomy' => $tax ) ); 809 $t4 = $this->factory->term->create( array( 'taxonomy' => $tax ) ); 810 811 $found = get_terms( $tax, array( 812 'fields' => 'ids', 813 'include' => array( $t4, $t1, $t2 ), 814 'orderby' => 'include', 815 'hide_empty' => false, 816 ) ); 817 818 _unregister_taxonomy( 'wptests_tax' ); 819 820 $this->assertEquals( array( $t4, $t1, $t2 ), $found ); 821 } 822 799 823 protected function create_hierarchical_terms_and_posts() { 800 824
Note: See TracChangeset
for help on using the changeset viewer.