Add 'orderby=description' support to `get_terms()`.

This fixes an interface inconsistency in edit-tags.php, where Description
appears as a sortable column header.

Props neil_pie.
Fixes #31364.
Built from https://develop.svn.wordpress.org/trunk@31532


git-svn-id: http://core.svn.wordpress.org/trunk@31513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2015-02-24 16:37:26 +00:00
parent 7c8b6609ca
commit 0d9275930b
2 changed files with 8 additions and 6 deletions

View File

@ -1575,9 +1575,9 @@ function get_term_to_edit( $id, $taxonomy ) {
* Optional. Array or string of arguments to get terms. * Optional. Array or string of arguments to get terms.
* *
* @type string $orderby Field(s) to order terms by. Accepts term fields ('name', 'slug', * @type string $orderby Field(s) to order terms by. Accepts term fields ('name', 'slug',
* 'term_group', 'term_id', 'id'), 'count' for term taxonomy count, * 'term_group', 'term_id', 'id', 'description'), 'count' for term
* 'include' to match the 'order' of the $include param, or 'none' * taxonomy count, 'include' to match the 'order' of the $include param,
* to skip ORDER BY. Defaults to 'name'. * or 'none' to skip ORDER BY. Defaults to 'name'.
* @type string $order Whether to order terms in ascending or descending order. * @type string $order Whether to order terms in ascending or descending order.
* Accepts 'ASC' (ascending) or 'DESC' (descending). * Accepts 'ASC' (ascending) or 'DESC' (descending).
* Default 'ASC'. * Default 'ASC'.
@ -1747,6 +1747,8 @@ function get_terms( $taxonomies, $args = '' ) {
$orderby = "FIELD( t.term_id, $include )"; $orderby = "FIELD( t.term_id, $include )";
} elseif ( 'term_group' == $_orderby ) { } elseif ( 'term_group' == $_orderby ) {
$orderby = 't.term_group'; $orderby = 't.term_group';
} elseif ( 'description' == $_orderby ) {
$orderby = 'tt.description';
} elseif ( 'none' == $_orderby ) { } elseif ( 'none' == $_orderby ) {
$orderby = ''; $orderby = '';
} elseif ( empty($_orderby) || 'id' == $_orderby ) { } elseif ( empty($_orderby) || 'id' == $_orderby ) {

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.2-alpha-31531'; $wp_version = '4.2-alpha-31532';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.