is_preview() ) { $cache = wp_cache_get( 'widget_recent_comments', 'widget' ); } if ( ! is_array( $cache ) ) { $cache = array(); } if ( ! isset( $args['widget_id'] ) ) $args['widget_id'] = $this->id; $lang = pll_current_language(); #added if ( isset( $cache[ $args['widget_id'] ][ $lang ] ) ) { #modified# echo $cache[ $args['widget_id'] ][ $lang ]; #modified# return; } $output = ''; $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Comments' ); /** This filter is documented in wp-includes/default-widgets.php */ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5; if ( ! $number ) $number = 5; /** * Filter the arguments for the Recent Comments widget. * * @since 3.4.0 * * @see WP_Comment_Query::query() for information on accepted arguments. * * @param array $comment_args An array of arguments used to retrieve the recent comments. */ $comments = get_comments( apply_filters( 'widget_comments_args', array( 'number' => $number, 'status' => 'approve', 'post_status' => 'publish' ) ) ); $output .= $args['before_widget']; if ( $title ) { $output .= $args['before_title'] . $title . $args['after_title']; } $output .= '