WordPress.org

Make WordPress Core

Ticket #3091: link-template.php.diff

File link-template.php.diff, 679 bytes (added by filosofo, 12 years ago)
  • wp-includes/link-template.php

     
    482482        if ( 'posts' == get_query_var('what_to_show') ) {
    483483                preg_match('#FROM\s(.*)\sORDER BY#siU', $wp_query->request, $matches);
    484484                $fromwhere = $matches[1];
    485                 $numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere");
     485                $numposts = $wpdb->get_var("SELECT COUNT(DISTINCT $wpdb->posts.ID) FROM $fromwhere");
    486486                $max_num_pages = ceil($numposts / $posts_per);
    487487        } else {
    488488                preg_match('#FROM\s(.*)\sORDER BY#siU', $wp_query->request, $matches);