From 5405bd383897ff39c837d785850f1ebd4c0778bc Mon Sep 17 00:00:00 2001 From: westi Date: Thu, 15 Sep 2011 10:08:43 +0000 Subject: [PATCH] Set a consistent cache key when using the_widget to display the Recent Posts and Recent Comments widgets so that they get cached. See #16761. git-svn-id: http://svn.automattic.com/wordpress/trunk@18677 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/default-widgets.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wp-includes/default-widgets.php b/wp-includes/default-widgets.php index e91b91dfb..38d43716e 100644 --- a/wp-includes/default-widgets.php +++ b/wp-includes/default-widgets.php @@ -525,7 +525,10 @@ class WP_Widget_Recent_Posts extends WP_Widget { if ( !is_array($cache) ) $cache = array(); - if ( isset( $args['widget_id'] ) && isset( $cache[ $args['widget_id'] ] ) ) { + if ( ! isset( $args['widget_id'] ) ) + $args['widget_id'] = $this->id; + + if ( false && isset( $cache[ $args['widget_id'] ] ) ) { echo $cache[ $args['widget_id'] ]; return; } @@ -628,7 +631,10 @@ class WP_Widget_Recent_Comments extends WP_Widget { if ( ! is_array( $cache ) ) $cache = array(); - if ( isset( $args['widget_id'] ) && isset( $cache[ $args['widget_id'] ] ) ) { + if ( ! isset( $args['widget_id'] ) ) + $args['widget_id'] = $this->id; + + if ( false && isset( $cache[ $args['widget_id'] ] ) ) { echo $cache[ $args['widget_id'] ]; return; }