We create beautiful & user-friendly websites and provide quality web development services worldwide.
Contact us to get started on your project.


How to Display Most Commented Posts in WordPress without a Plugin

Published by Veron Ang | 2

How to Display Most Commented Posts in WordPress Without a Plugin

For those of you that run a WordPress site, you may wish to display a list of posts with the most number of comments. This is typically achieved by using a plugin/widget. But did you know that you can easily do this without a plugin too?

You can use the query_posts() function to display your most commented posts without a plugin, thanks to the new comment_count orderby parameter available since WordPress version 2.9.

Display Most Commented Posts in WordPress Without a Plugin

	<?php $wp_query =
		new WP_Query('caller_get_posts=1&orderby=comment_count&posts_per_page=10');
		while ($wp_query->have_posts()) : $wp_query->the_post(); { ?>
			<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a> (<?php comments_number('0 comment', '1 comment', '% comments'); ?>)</li>
	<?php } endwhile; ?>

Note: To change the number of posts to display, modify the posts_per_page parameter.

About the Author

Veron Ang is a , developer and WordPress expert at Sparklette Studio. She graduated with a bachelor's degree in computer science from the National University of Singapore. Engage her to work on your next project by sending her a message from the contact page or on Twitter.


  • And How about adding thumbnails to them?

    • Thanks but I’m looking something as most commented today , this week and this month do you have any idea?

Leave a comment