Posts_per_page not working with date_query
-
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
The topic ‘Posts_per_page not working with date_query’ is closed to new replies.