WordPress.org

Make WordPress Core

Ticket #15950: 15950.patch

File 15950.patch, 633 bytes (added by johnbillion, 7 years ago)
  • wp-includes/canonical.php

     
    403403        if ( get_query_var('day') )
    404404                $where .= $wpdb->prepare(" AND DAYOFMONTH(post_date) = %d", get_query_var('day'));
    405405
    406         $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE $where AND post_status = 'publish'");
     406        $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE $where AND post_status = 'publish' ORDER BY post_parent ASC");
    407407        if ( !$post_id )
    408408                return false;
    409409        return get_permalink($post_id);