Title: query_posts() breaks comments_template()
Last modified: August 19, 2016

---

# query_posts() breaks comments_template()

 *  Resolved [innovine](https://wordpress.org/support/users/innovine/)
 * (@innovine)
 * [17 years ago](https://wordpress.org/support/topic/query_posts-breaks-comments_template/)
 * I have included comments_template() in my Loop, as I want the front page of my
   blog to show all the recent comments. I’ve noticed however that if I add query_posts(‘
   showposts=10’); before the loop, the comments stop working (the add comment link
   just reloads the main page)
 * This does not occur if I take the index.php code and use it in a page template…
 * I havn’t really changed anything else from the default installation. Any suggestions
   for what is happening?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [innovine](https://wordpress.org/support/users/innovine/)
 * (@innovine)
 * [17 years ago](https://wordpress.org/support/topic/query_posts-breaks-comments_template/#post-1088000)
 * Aha!
    This seems to be fixed by using: `<?php query_posts($query_string."&showposts
   =10"); ?>`
 *  [kule](https://wordpress.org/support/users/kule/)
 * (@kule)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/query_posts-breaks-comments_template/#post-1088215)
 * Just putting this here too as it’s relevant:
 * I had this problem when creating a new template. I had used the sidebar before
   the index/single page which meant I used query_posts to pull out a specific selection
   of posts before the main loop runs.
 * If you do your own custom query_posts make sure you do a wp_reset_query after
   then the comments will work properly.
 * Cheers
    Luke

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘query_posts() breaks comments_template()’ is closed to new replies.

## Tags

 * [comments_template](https://wordpress.org/support/topic-tag/comments_template/)
 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [kule](https://wordpress.org/support/users/kule/)
 * Last activity: [16 years, 2 months ago](https://wordpress.org/support/topic/query_posts-breaks-comments_template/#post-1088215)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
