WordPress.org

Make WordPress Core

Ticket #15400: reduct_recent_comments_widget_queries.patch

File reduct_recent_comments_widget_queries.patch, 1.2 KB (added by chalet16, 5 years ago)

patch

Line 
1diff --exclude=.svn -r wp-includes-old/default-widgets.php wp-includes/default-widgets.php
2651c651
3<
4---
5>               add_action('comments_clauses', array( 'WP_Widget_Recent_Comments', 'comments_query_filter'));
6652a653
7>               remove_action('comments_clauses', array( 'WP_Widget_Recent_Comments', 'comments_query_filter'));
8656c657
9<
10---
11>               
12658a660
13>
14660c662,664
15<                               $output .=  '<li class="recentcomments">' . /* translators: comments widget: 1: comment author, 2: post link */ sprintf(_x('%1$s on %2$s', 'widgets'), get_comment_author_link(), '<a href="' . esc_url( get_comment_link($comment->comment_ID) ) . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>';
16---
17>                               get_post($comment);
18>
19>                               $output .=  '<li class="recentcomments">' . /* translators: comments widget: 1: comment author, 2: post link */ sprintf(_x('%1$s on %2$s', 'widgets'), get_comment_author_link(), '<a href="' . esc_url( get_comment_link($comment) ) . '">' . get_the_title($comment) . '</a>') . '</li>';
20694a699,706
21>       
22>       function comments_query_filter($pieces) {
23>               global $wpdb;
24>               
25>               $pieces['join'] .= " LEFT JOIN $wpdb->posts ON ( $wpdb->comments.comment_post_ID = $wpdb->posts.ID )";
26>               
27>               return $pieces;
28>       }