From 48a5bbf8a7a782f0761c124f147c4ea33d14774f Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Fri, 13 Feb 2015 17:00:27 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@31452 git-svn-id: http://core.svn.wordpress.org/trunk@31433 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/general-template.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 15ec1e4396..02e45d52fd 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -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"; diff --git a/wp-includes/version.php b/wp-includes/version.php index 4b55c00b9a..9fa706705c 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.2-alpha-31451'; +$wp_version = '4.2-alpha-31452'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.