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:
Boone Gorges
2015-09-04 21:16:11 +00:00
parent dfceba6d05
commit 9dfc5551ee
2 changed files with 29 additions and 1 deletions
+2 -1
View File
@@ -945,6 +945,7 @@ function get_term_to_edit( $id, $taxonomy ) {
*
* @since 2.3.0
* @since 4.2.0 Introduced 'name' and 'childless' parameters.
* @since 4.4.0 Introduced the ability to pass 'term_id' as an alias of 'id' for the `orderby` parameter.
*
* @global wpdb $wpdb WordPress database abstraction object.
* @global array $wp_filter
@@ -1132,7 +1133,7 @@ function get_terms( $taxonomies, $args = '' ) {
$orderby = 'tt.description';
} elseif ( 'none' == $_orderby ) {
$orderby = '';
} elseif ( empty($_orderby) || 'id' == $_orderby ) {
} elseif ( empty( $_orderby ) || 'id' == $_orderby || 'term_id' === $_orderby ) {
$orderby = 't.term_id';
} else {
$orderby = 't.name';