mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-01 11:14:36 +00:00
In get_terms(), allow terms to be ordered by 'term_id'.
[29128] introduced updated documentation for the `'orderby'` parameter of `get_terms()`. The new documentation mistakenly said that 'term_id' was a valid orderby value. The current changeset makes that fantasy...A REALITY. Props ixkaito. Fixes #33726. git-svn-id: https://develop.svn.wordpress.org/trunk@33903 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1186,6 +1186,33 @@ class Tests_Term_getTerms extends WP_UnitTestCase {
|
||||
$this->assertEquals( array( $t2, $t1, $t4, $t3 ), $found );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 33726
|
||||
*/
|
||||
public function test_orderby_term_id() {
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
$t1 = $this->factory->term->create( array(
|
||||
'taxonomy' => 'wptests_tax',
|
||||
'name' => 'AAA',
|
||||
) );
|
||||
$t2 = $this->factory->term->create( array(
|
||||
'taxonomy' => 'wptests_tax',
|
||||
'name' => 'ZZZ',
|
||||
) );
|
||||
$t3 = $this->factory->term->create( array(
|
||||
'taxonomy' => 'wptests_tax',
|
||||
'name' => 'JJJ',
|
||||
) );
|
||||
|
||||
$found = get_terms( 'wptests_tax', array(
|
||||
'orderby' => 'term_id',
|
||||
'hide_empty' => false,
|
||||
'fields' => 'ids',
|
||||
) );
|
||||
|
||||
$this->assertEquals( array( $t1, $t2, $t3 ), $found );
|
||||
}
|
||||
|
||||
public function test_hierarchical_false_with_parent() {
|
||||
$initial_terms = $this->create_hierarchical_terms();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user