How to display most commented posts for the past week

I need to display most commented posts and articles for the past week.
The code I came up with is following:

       $cat_black_args = array(
            'posts_per_page'    => '4',
            'orderby'           => 'date comment_count',
            'order'             => 'DESC',
            'category_name'     => $current_cat,
            'date_query'        => array(
                array(
                    'before' => array(
                        'year'  => date( "Y" ),
                        'month' => date( "m", strtotime( "-1 months" ) ),
                        'day'   => date( "d", strtotime( "-2 week" ) ),
                    ),
                )
            )
        );

It does work without data_query but most commented posts is display over all times with or without data_query.

Read more here: How to display most commented posts for the past week

Leave a Reply

Your email address will not be published. Required fields are marked *