In this code snippet we will share how to display the most commented posts in WordPress. If you want to display top 10 most commented posts, You need to add the following code where you want to display most commented posts.

You might also like…

Code Snippet:

The following code will display 10 most commented posts:

<ul class="popular_posts">
	<?php $pc = new WP_Query('orderby=comment_count&posts_per_page=10'); 
	
	while ($pc->have_posts()) : $pc->the_post(); ?>
		<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
		<p>Posted by <strong><?php the_author() ?></strong> with <?php comments_popup_link('No Comments;', '1 Comment', '% Comments'); ?></p></li>
	<?php endwhile; ?>

	<?php wp_reset_postdata(); ?>
</ul>

Hope this is useful for you 🙂

If you feel this snippet useful? Any questions? Do let me know via comments.

How to Display Most Commented Posts in WordPress
5 (100%) 3 votes

(Visited 22 times, 1 visits today)

Leave a Comment

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