Changeset 33903
- Timestamp:
- 09/04/2015 09:16:11 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/taxonomy-functions.php
r33760 r33903 946 946 * @since 2.3.0 947 947 * @since 4.2.0 Introduced 'name' and 'childless' parameters. 948 * @since 4.4.0 Introduced the ability to pass 'term_id' as an alias of 'id' for the `orderby` parameter. 948 949 * 949 950 * @global wpdb $wpdb WordPress database abstraction object. … … 1133 1134 } elseif ( 'none' == $_orderby ) { 1134 1135 $orderby = ''; 1135 } elseif ( empty( $_orderby) || 'id'== $_orderby ) {1136 } elseif ( empty( $_orderby ) || 'id' == $_orderby || 'term_id' === $_orderby ) { 1136 1137 $orderby = 't.term_id'; 1137 1138 } else { -
trunk/tests/phpunit/tests/term/getTerms.php
r32353 r33903 1187 1187 } 1188 1188 1189 /** 1190 * @ticket 33726 1191 */ 1192 public function test_orderby_term_id() { 1193 register_taxonomy( 'wptests_tax', 'post' ); 1194 $t1 = $this->factory->term->create( array( 1195 'taxonomy' => 'wptests_tax', 1196 'name' => 'AAA', 1197 ) ); 1198 $t2 = $this->factory->term->create( array( 1199 'taxonomy' => 'wptests_tax', 1200 'name' => 'ZZZ', 1201 ) ); 1202 $t3 = $this->factory->term->create( array( 1203 'taxonomy' => 'wptests_tax', 1204 'name' => 'JJJ', 1205 ) ); 1206 1207 $found = get_terms( 'wptests_tax', array( 1208 'orderby' => 'term_id', 1209 'hide_empty' => false, 1210 'fields' => 'ids', 1211 ) ); 1212 1213 $this->assertEquals( array( $t1, $t2, $t3 ), $found ); 1214 } 1215 1189 1216 public function test_hierarchical_false_with_parent() { 1190 1217 $initial_terms = $this->create_hierarchical_terms();
Note: See TracChangeset
for help on using the changeset viewer.