Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

sh3nka7a on "Querying most commented in the last week"

$
0
0

Hello, im trying to show the most commented 5 post in the last week, here is my code
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'orderby' => 'comment_count',

'order' => 'DESC',
'date_query' => array(
array(
'year' => date('Y'),
'week' => date('W'),
),
),
'posts_per_page'=> 5,
);

$the_query = new WP_Query($args);

while ( $the_query->have_posts()) : $the_query->the_post(); ?>
That returns me over 300 posts, tho they are ordered by comment cound, how to fix that


Viewing all articles
Browse latest Browse all 8245

Trending Articles