Ticket #12219: ticket-12219_wp30_recent-comments-widget_attachment-comments.patch
| File ticket-12219_wp30_recent-comments-widget_attachment-comments.patch, 984 bytes (added by tfnab, 3 years ago) |
|---|
-
wp-includes/default-widgets.php
634 634 $number = 15; 635 635 636 636 if ( !$comments = wp_cache_get( 'recent_comments', 'widget' ) ) { 637 $comments = $wpdb->get_results("SELECT $wpdb->comments.* FROM $wpdb->comments JOIN $wpdb->posts ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID WHERE comment_approved = '1' AND post_status = 'publish'ORDER BY comment_date_gmt DESC LIMIT 15");637 $comments = $wpdb->get_results("SELECT c.* FROM $wpdb->comments c JOIN $wpdb->posts p ON p.ID = c.comment_post_ID LEFT JOIN $wpdb->posts a ON a.ID = p.post_parent WHERE c.comment_approved = '1' AND ( p.post_status = 'publish' OR ( p.post_type = 'attachment' AND a .post_status = 'publish' )) ORDER BY comment_date_gmt DESC LIMIT 15"); 638 638 wp_cache_add( 'recent_comments', $comments, 'widget' ); 639 639 } 640 640
