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:
parent
0efce8c89c
commit
487d65ad78
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user