Additional 'orderby' values for `wp_get_object_terms()`.
Adds support for ordering by 'taxonomy', 'term_taxonomy_id', and 'parent'. Props ChriCo. Fixes #28688. Built from https://develop.svn.wordpress.org/trunk@31236 git-svn-id: http://core.svn.wordpress.org/trunk@31217 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
00436f6886
commit
42ec13030c
|
@ -2562,7 +2562,7 @@ function wp_delete_category( $cat_ID ) {
|
|||
* @param array|string $args {
|
||||
* Array of arguments.
|
||||
* @type string $orderby Field by which results should be sorted. Accepts 'name', 'count', 'slug', 'term_group',
|
||||
* or 'term_order'. Default 'name'.
|
||||
* 'term_order', 'taxonomy', 'parent', or 'term_taxonomy_id'. Default 'name'.
|
||||
* @type string $order Sort order. Accepts 'ASC' or 'DESC'. Default 'ASC'.
|
||||
* @type string $fields Fields to return for matched terms. Accepts 'all', 'ids', 'names', and
|
||||
* 'all_with_object_id'. Note that 'all' or 'all_with_object_id' will result in an array of
|
||||
|
@ -2612,17 +2612,13 @@ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {
|
|||
$order = $args['order'];
|
||||
$fields = $args['fields'];
|
||||
|
||||
if ( 'count' == $orderby ) {
|
||||
$orderby = 'tt.count';
|
||||
} elseif ( 'name' == $orderby ) {
|
||||
$orderby = 't.name';
|
||||
} elseif ( 'slug' == $orderby ) {
|
||||
$orderby = 't.slug';
|
||||
} elseif ( 'term_group' == $orderby ) {
|
||||
$orderby = 't.term_group';
|
||||
} elseif ( 'term_order' == $orderby ) {
|
||||
if ( in_array( $orderby, array( 'term_id', 'name', 'slug', 'term_group' ) ) ) {
|
||||
$orderby = "t.$orderby";
|
||||
} else if ( in_array( $orderby, array( 'count', 'parent', 'taxonomy', 'term_taxonomy_id' ) ) ) {
|
||||
$orderby = "tt.$orderby";
|
||||
} else if ( 'term_order' === $orderby ) {
|
||||
$orderby = 'tr.term_order';
|
||||
} elseif ( 'none' == $orderby ) {
|
||||
} else if ( 'none' === $orderby ) {
|
||||
$orderby = '';
|
||||
$order = '';
|
||||
} else {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.2-alpha-31235';
|
||||
$wp_version = '4.2-alpha-31236';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue