WordPress.org

Make WordPress Core

Ticket #8107: 8107.2.patch

File 8107.2.patch, 1.2 KB (added by Viper007Bond, 5 years ago)

Fix mistype (I had %s instead of %d)

  • wp-includes/link-template.php

     
    899899 
    900900        $adjacent = $previous ? 'previous' : 'next'; 
    901901        $op = $previous ? '<' : '>'; 
    902         $order = $previous ? 'DESC' : 'ASC'; 
     902        $order = $previous ? 'DESC, p.ID DESC' : 'ASC, p.ID ASC'; 
    903903 
    904904        $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 %d ) || 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 ); 
    906906        $sort  = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1" ); 
    907907 
    908908        return $wpdb->get_row("SELECT p.* FROM $wpdb->posts AS p $join $where $sort");