mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-05-26 06:04:31 +00:00
Provide a secondary sort order for wp_get_archives() when type=postbypost.
Sorting by post_date alone can cause indeterminacy problems on different versions of MySQL when post_date ties need to be broken. Using `ID` as a secondary sort ensures that the order is always determinate. Props herbmillerjr for an initial patch. Fixes #30480. git-svn-id: https://develop.svn.wordpress.org/trunk@31452 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1483,7 +1483,7 @@ function wp_get_archives( $args = '' ) {
|
||||
}
|
||||
}
|
||||
} elseif ( ( 'postbypost' == $r['type'] ) || ('alpha' == $r['type'] ) ) {
|
||||
$orderby = ( 'alpha' == $r['type'] ) ? 'post_title ASC ' : 'post_date DESC ';
|
||||
$orderby = ( 'alpha' == $r['type'] ) ? 'post_title ASC ' : 'post_date DESC, ID DESC ';
|
||||
$query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit";
|
||||
$key = md5( $query );
|
||||
$key = "wp_get_archives:$key:$last_changed";
|
||||
|
||||
Reference in New Issue
Block a user