diff --git a/wp-includes/default-widgets.php b/wp-includes/default-widgets.php index 407af8f58..e3444e777 100644 --- a/wp-includes/default-widgets.php +++ b/wp-includes/default-widgets.php @@ -495,7 +495,8 @@ class WP_Widget_Recent_Posts extends WP_Widget { function WP_Widget_Recent_Posts() { $widget_ops = array('classname' => 'widget_recent_entries', 'description' => __( "The most recent posts on your blog") ); - $this->WP_Widget('recent_posts', __('Recent Posts'), $widget_ops); + $this->WP_Widget('recent-posts', __('Recent Posts'), $widget_ops); + $this->alt_option_name = 'widget_recent_entries'; add_action( 'save_post', array(&$this, 'flush_widget_cache') ); add_action( 'deleted_post', array(&$this, 'flush_widget_cache') ); @@ -503,11 +504,10 @@ class WP_Widget_Recent_Posts extends WP_Widget { } function widget($args, $instance) { - if ( $output = wp_cache_get('widget_recent_entries', 'widget') ) + if ( $output = wp_cache_get('widget_recent_posts' . $args['widget_id'], 'widget') ) return print($output); ob_start(); - extract($args); $title = empty($instance['title']) ? __('Recent Posts') : apply_filters('widget_title', $instance['title']); @@ -517,7 +517,7 @@ class WP_Widget_Recent_Posts extends WP_Widget { $number = 1; else if ( $number > 15 ) $number = 15; - + $r = new WP_Query(array('showposts' => $number, 'what_to_show' => 'posts', 'nopaging' => 0, 'post_status' => 'publish', 'caller_get_posts' => 1)); if ($r->have_posts()) : ?> @@ -532,8 +532,8 @@ class WP_Widget_Recent_Posts extends WP_Widget { flush_widget_cache(); + + $alloptions = wp_cache_get( 'alloptions', 'options' ); + if ( isset($alloptions['widget_recent_entries']) ) + delete_option('widget_recent_entries'); return $instance; } diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index c728fdb06..80f69fab7 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -267,6 +267,9 @@ class WP_Widget { function get_settings() { $settings = get_option($this->option_name); + + if ( false === $settings && isset($this->alt_option_name) ) + $settings = get_option($this->alt_option_name); if ( !is_array($settings) ) $settings = array(); @@ -976,9 +979,9 @@ function wp_convert_widget_settings($base_name, $option_name, $settings) { if ( empty($settings) ) { $single = true; } else { - if ( isset($settings['number']) ) - unset($settings['number']); foreach ( array_keys($settings) as $number ) { + if ( 'number' == $number ) + continue; if ( !is_numeric($number) ) { $single = true; break;