Make WordPress Core

Ticket #4309: widgets-recent-comments-respect-trackback-pref.diff

File widgets-recent-comments-respect-trackback-pref.diff, 1.1 KB (added by technosailor, 15 years ago)

Replaces original that had other mods included. My bad.

  • wp-includes/widgets.php

     
    741741                $number = 15;
    742742
    743743        if ( !$comments = wp_cache_get( 'recent_comments', 'widget' ) ) {
    744                 $comments = $wpdb->get_results("SELECT comment_author, comment_author_url, comment_ID, comment_post_ID FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $number");
     744                if( get_option('default_ping_status') == 'open' )
     745                {
     746                        $comments = $wpdb->get_results("SELECT comment_author, comment_author_url, comment_ID, comment_post_ID FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $number");
     747                }
     748                else
     749                {
     750                        $comments = $wpdb->get_results("SELECT comment_author, comment_author_url, comment_ID, comment_post_ID FROM $wpdb->comments WHERE comment_approved = '1' AND comment_type NOT IN ('trackback', 'pingback') ORDER BY comment_date_gmt DESC LIMIT $number");
     751                }
    745752                wp_cache_add( 'recent_comments', $comments, 'widget' );
    746753        }
    747754?>