diff --git a/wp-includes/default-widgets.php b/wp-includes/default-widgets.php
index 973d450735..7d06991a5b 100644
--- a/wp-includes/default-widgets.php
+++ b/wp-includes/default-widgets.php
@@ -588,7 +588,6 @@ class WP_Widget_Recent_Posts extends WP_Widget {
-
id_base);
- if ( !$number = (int) $instance['number'] )
- $number = 5;
- else if ( $number < 1 )
- $number = 1;
- else if ( $number > 15 )
- $number = 15;
-
- if ( !$comments = wp_cache_get( 'recent_comments', 'widget' ) ) {
- $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");
- wp_cache_add( 'recent_comments', $comments, 'widget' );
+ global $comments, $comment;
+
+ $cache = wp_cache_get('widget_recent_comments', 'widget');
+
+ if ( ! is_array( $cache ) )
+ $cache = array();
+
+ if ( isset( $cache[$args['widget_id']] ) ) {
+ echo $cache[$args['widget_id']];
+ return;
}
- $comments = array_slice( (array) $comments, 0, $number );
-?>
-
-
-
-
- $number));
+ $output .= $before_widget;
+ if ( $title )
+ $output .= $before_title . $title . $after_title;
+
+ $output .= '';
+ $output .= $after_widget;
+
+ echo $output;
+ $cache[$args['widget_id']] = $output;
+ wp_cache_set('widget_recent_comments', $cache, 'widget');
}
function update( $new_instance, $old_instance ) {
@@ -672,7 +683,6 @@ class WP_Widget_Recent_Comments extends WP_Widget {
-