Ticket #32651: patch.diff
File patch.diff, 1.5 KB (added by , 9 years ago) |
---|
-
trunk/wp-includes/link-template.php
1571 1571 } 1572 1572 1573 1573 $adjacent = $previous ? 'previous' : 'next'; 1574 $op = $previous ? '< ' : '>';1574 $op = $previous ? '<=' : '>='; 1575 1575 $order = $previous ? 'DESC' : 'ASC'; 1576 1576 1577 1577 /** … … 1600 1600 * @param bool $in_same_term Whether post should be in a same taxonomy term. 1601 1601 * @param array $excluded_terms Array of excluded term IDs. 1602 1602 */ 1603 $where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare( "WHERE p.post_date $op %s AND p. post_type = %s $where", $current_post_date, $post->post_type ), $in_same_term, $excluded_terms );1603 $where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare( "WHERE p.post_date $op %s AND p.ID != %d AND p.post_type = %s $where", $current_post_date, $post->ID, $post->post_type ), $in_same_term, $excluded_terms ); 1604 1604 1605 1605 /** 1606 1606 * Filter the ORDER BY clause in the SQL for an adjacent post query. … … 1612 1612 * 1613 1613 * @param string $order_by The `ORDER BY` clause in the SQL. 1614 1614 */ 1615 $sort = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1" );1615 $sort = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order, p.ID $order LIMIT 1" ); 1616 1616 1617 1617 $query = "SELECT p.ID FROM $wpdb->posts AS p $join $where $sort"; 1618 1618 $query_key = 'adjacent_post_' . md5( $query );