Ticket #8107: 8107.patch
File 8107.patch, 1.2 KB (added by , 15 years ago) |
---|
-
wp-includes/link-template.php
899 899 900 900 $adjacent = $previous ? 'previous' : 'next'; 901 901 $op = $previous ? '<' : '>'; 902 $order = $previous ? 'DESC ' : 'ASC';902 $order = $previous ? 'DESC, p.ID DESC' : 'ASC, p.ID ASC'; 903 903 904 904 $join = apply_filters( "get_{$adjacent}_post_join", $join, $in_same_cat, $excluded_categories ); 905 $where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare("WHERE p.post_date $op %s AND p.post_type = 'post' AND p.post_status = 'publish' $posts_in_ex_cats_sql", $current_post_date), $in_same_cat, $excluded_categories );905 $where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare("WHERE ( ( p.post_date = %s && p.ID $op %s ) || p.post_date $op %s ) AND p.post_type = 'post' AND p.post_status = 'publish' $posts_in_ex_cats_sql", $current_post_date, $post->ID, $current_post_date), $in_same_cat, $excluded_categories ); 906 906 $sort = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1" ); 907 907 908 908 return $wpdb->get_row("SELECT p.* FROM $wpdb->posts AS p $join $where $sort");