diff --git a/src/wp-includes/widgets/class-wp-widget-recent-posts.php b/src/wp-includes/widgets/class-wp-widget-recent-posts.php index 512009dde9..f6308d9c2a 100644 --- a/src/wp-includes/widgets/class-wp-widget-recent-posts.php +++ b/src/wp-includes/widgets/class-wp-widget-recent-posts.php @@ -20,10 +20,6 @@ class WP_Widget_Recent_Posts extends WP_Widget { $widget_ops = array('classname' => 'widget_recent_entries', 'description' => __( "Your site’s most recent Posts.") ); parent::__construct('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') ); - add_action( 'switch_theme', array($this, 'flush_widget_cache') ); } /** @@ -31,26 +27,10 @@ class WP_Widget_Recent_Posts extends WP_Widget { * @param array $instance */ public function widget( $args, $instance ) { - $cache = array(); - if ( ! $this->is_preview() ) { - $cache = wp_cache_get( 'widget_recent_posts', 'widget' ); - } - - if ( ! is_array( $cache ) ) { - $cache = array(); - } - if ( ! isset( $args['widget_id'] ) ) { $args['widget_id'] = $this->id; } - if ( isset( $cache[ $args['widget_id'] ] ) ) { - echo $cache[ $args['widget_id'] ]; - return; - } - - ob_start(); - $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Posts' ); /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ @@ -99,13 +79,6 @@ class WP_Widget_Recent_Posts extends WP_Widget { wp_reset_postdata(); endif; - - if ( ! $this->is_preview() ) { - $cache[ $args['widget_id'] ] = ob_get_flush(); - wp_cache_set( 'widget_recent_posts', $cache, 'widget' ); - } else { - ob_end_flush(); - } } /** @@ -118,22 +91,9 @@ class WP_Widget_Recent_Posts extends WP_Widget { $instance['title'] = sanitize_text_field( $new_instance['title'] ); $instance['number'] = (int) $new_instance['number']; $instance['show_date'] = isset( $new_instance['show_date'] ) ? (bool) $new_instance['show_date'] : false; - $this->flush_widget_cache(); - - $alloptions = wp_cache_get( 'alloptions', 'options' ); - if ( isset($alloptions['widget_recent_entries']) ) - delete_option('widget_recent_entries'); - return $instance; } - /** - * @access public - */ - public function flush_widget_cache() { - wp_cache_delete('widget_recent_posts', 'widget'); - } - /** * @param array $instance */