I’m trying to loop through the 4 most commented posts with the following code:-
<?php $mcQuery = new WP_Query ( array ('orderby' => 'comment_count', 'order' => 'DESC', 'posts_per_page' => '4' ) ); if ( $mcQuery->have_posts ()) : while ( $mcQuery->have_posts () ) : $mcQuery->the_post (); ?>
<?php endwhile; endif; wp_reset_postdata (); ?>
All I get back is the 4 most recent posts, posts_per_page working as expected but not the orderby.
Anyone have any suggestions as to what is happening or spot anything I am doing wrong?
- The topic ‘orderby comment_count being ignored’ is closed to new replies.