Skip to:
Content

bbPress.org

Ticket #1918: replies_widget_query_filter.diff

File replies_widget_query_filter.diff, 859 bytes (added by morgul, 6 years ago)

Allow filtering of replies widget's query

  • includes/common/widgets.

    old new  
    11291129
    11301130                // Note: private and hidden forums will be excluded via the
    11311131                // bbp_pre_get_posts_normalize_forum_visibility action and function.
    1132                 $widget_query = new WP_Query( array(
     1132                $widget_query = array(
    11331133                        'post_type'           => bbp_get_reply_post_type(),
    11341134                        'post_status'         => array( bbp_get_public_status_id(), bbp_get_closed_status_id() ),
    11351135                        'posts_per_page'      => (int) $settings['max_shown'],
    11361136                        'ignore_sticky_posts' => true,
    11371137                        'no_found_rows'       => true,
    1138                 ) );
     1138                );
     1139                $widget_query = apply_filters( 'bbp_replies_widget_query', $widget_query );
     1140                $widget_query = new WP_Query( $widget_query );
    11391141
    11401142                // Bail if no replies
    11411143                if ( ! $widget_query->have_posts() ) {