WordPress.org

Make WordPress Core

Ticket #15400: 15400-1-reduce-to-one-query-when-pagination-disabled.patch

File 15400-1-reduce-to-one-query-when-pagination-disabled.patch, 747 bytes (added by westi, 7 years ago)

Patch from http://www.google-melange.com/gci/task/show/google/gci2010/wordpress/t129162975592

  • wp-includes/default-widgets.php

     
    650650                        $number = 1;
    651651
    652652                $comments = get_comments( array( 'number' => $number, 'status' => 'approve' ) );
     653                $posts = array();
     654                foreach ( (array) $comments as $comment) {
     655                        $posts[] = $comment->comment_post_ID;
     656                }
     657                $posts = array_unique($posts);
     658                get_posts( array( 'post__in' => $posts, 'numberposts' => -1, 'update_post_meta_cache' => false, 'update_post_term_cache' => false, 'posts_per_page' => -1 ) );
    653659                $output .= $before_widget;
    654660                if ( $title )
    655661                        $output .= $before_title . $title . $after_title;