WordPress.org

Make WordPress Core

Ticket #16159: 16159.2.patch

File 16159.2.patch, 1.3 KB (added by scribu, 4 years ago)
  • wp-includes/default-widgets.php

    diff --git wp-includes/default-widgets.php wp-includes/default-widgets.php
    index b0c63b5..4d269f1 100644
    class WP_Widget_Recent_Posts extends WP_Widget { 
    543543                if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) ) 
    544544                        $number = 10; 
    545545 
    546                 $r = new WP_Query(array('posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true)); 
     546                $r = new WP_Query( apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true ) ) ); 
    547547                if ($r->have_posts()) : 
    548548?> 
    549549                <?php echo $before_widget; ?> 
    class WP_Widget_Recent_Comments extends WP_Widget { 
    649649                if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) ) 
    650650                        $number = 5; 
    651651 
    652                 $comments = get_comments( array( 'number' => $number, 'status' => 'approve', 'post_status' => 'publish' ) ); 
     652                $comments = get_comments( apply_filters( 'widget_comments_args', array( 'number' => $number, 'status' => 'approve', 'post_status' => 'publish' ) ) ); 
    653653                $output .= $before_widget; 
    654654                if ( $title ) 
    655655                        $output .= $before_title . $title . $after_title;