Geek Rant dot org

Fri 2006-04-21

WordPress Most comments

Filed under: — daniel @ 07:05

Here’s the SQL to find which of your Wordpress posts have the most comments:

SELECT wp_comments.comment_post_id, count(*) as commentcount, wp_posts.post_title, wp_posts.post_date FROM wp_comments, wp_posts
where wp_comments.comment_post_id = wp_posts.ID
group by wp_comments.comment_post_id, wp_posts.post_title, wp_posts.post_date
order by commentcount desc

Bookmark and Share

2 Responses to “WordPress Most comments”

  1. Glen McGregor says:

    So which post has the most comments? It’d be interesting to know. Unless of course there’s lively discussion here and this post ends up with the most!

Leave a Reply


29 queries. 0.919 seconds. Powered by WordPress