Ticket #28439: 28439.patch
File 28439.patch, 1.0 KB (added by , 11 years ago) |
---|
-
wp-includes/taxonomy.php
1385 1385 $orderby = 't.slug'; 1386 1386 } else if ( 'term_group' == $_orderby ) { 1387 1387 $orderby = 't.term_group'; 1388 } else if ( 'post_date' == $_orderby ) { 1389 $orderby = 'p.post_date'; 1388 1390 } else if ( 'none' == $_orderby ) { 1389 1391 $orderby = ''; 1390 1392 } elseif ( empty($_orderby) || 'id' == $_orderby ) { … … 1561 1563 1562 1564 $join = "INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id"; 1563 1565 1566 // if we're ordering by date, we need to JOIN term_relationships and posts 1567 if ( 'post_date' == $_orderby ) { 1568 // JOIN with wp_term_relationships 1569 $join .= " JOIN $wpdb->term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id"; 1570 // JOIN with wp_posts 1571 $join .= " JOIN $wpdb->posts AS p ON p.ID = tr.object_id"; 1572 } 1573 1564 1574 $pieces = array( 'fields', 'join', 'where', 'orderby', 'order', 'limits' ); 1565 1575 1566 1576 /**