How to Display Most Commented Posts in WordPress

Retrieve the most commented WordPress posts:

$most_commented = wp_get_recent_posts( "post_type=post&numberposts=10&order=desc&orderby=comment_count&post_status=publish", ARRAY_A );
 
foreach( $most_commented as $article )
{
    echo '<li>'.number_format(intval($article['comment_count'])).' Comments - <a href="'.get_permalink( $article['ID'] ).'" title="'.get_the_title( $article['ID'] ).'">'.get_the_title( $article['ID'] ).'</a></li>';
}

More Related Posts