mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-08 16:41:44 +01:00
Fix default orderby for tt_id query. see #9937
git-svn-id: http://svn.automattic.com/wordpress/trunk@11468 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b664e6a452
commit
b32a87962a
@ -1250,7 +1250,10 @@ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {
|
|||||||
$orderby = '';
|
$orderby = '';
|
||||||
$order = '';
|
$order = '';
|
||||||
} else {
|
} else {
|
||||||
$orderby = 't.term_id';
|
if ( 'tt_ids' == $fields )
|
||||||
|
$orderby = 'tr.term_taxonomy_id';
|
||||||
|
else
|
||||||
|
$orderby = 't.term_id';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($orderby) )
|
if ( !empty($orderby) )
|
||||||
@ -1277,8 +1280,6 @@ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {
|
|||||||
} else if ( 'ids' == $fields || 'names' == $fields ) {
|
} else if ( 'ids' == $fields || 'names' == $fields ) {
|
||||||
$terms = array_merge($terms, $wpdb->get_col($query));
|
$terms = array_merge($terms, $wpdb->get_col($query));
|
||||||
} else if ( 'tt_ids' == $fields ) {
|
} else if ( 'tt_ids' == $fields ) {
|
||||||
if ( !empty($order_by) )
|
|
||||||
$orderby = "ORDER BY tr.term_taxonomy_id";
|
|
||||||
$terms = $wpdb->get_col("SELECT tr.term_taxonomy_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tr.object_id IN ($object_ids) AND tt.taxonomy IN ($taxonomies) $orderby $order");
|
$terms = $wpdb->get_col("SELECT tr.term_taxonomy_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tr.object_id IN ($object_ids) AND tt.taxonomy IN ($taxonomies) $orderby $order");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user