Title: Comments go to wrong post
Last modified: August 20, 2016

---

# Comments go to wrong post

 *  Resolved [roger17](https://wordpress.org/support/users/roger17/)
 * (@roger17)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/comments-go-to-wrong-post/)
 * Hi everyone,
 * My wordpress theme is working really fine but there is one problem that i can’t
   solve even after doing all the required things written here to solve that problem.
 * Whenever someone comments on my post, that comment goes to the one fix post.
 * and here is one more interesting thing.Even that fix post gets changed after 
   some days and then the comments get displayed on that post.
 * Can anybody solve the problem?
 * I think the problem lies here in comments.php
 * >  <!– Begin Comments List –>
   >  <?php if ($comments) : ?> <h2 id=”comments”><?
   > php comments_number(‘No Comments’, ‘One Comment’, ‘% Comments’ );?> on “<?php
   > the_title(); ?>”</h2> <ul class=”commentlist”> <?php foreach ($comments as 
   > $comment) : ?> <?php $comment_type = get_comment_type(); ?> <?php if($comment_type
   > == ‘comment’) { ?> <li <?php echo $oddcomment; ?>id=”comment-<?php comment_ID()?
   > >”>

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/comments-go-to-wrong-post/#post-2884976)
 * you probably have some ‘related posts’ section in single.php between the post’s
   content and the comment form;
    either coded into your template, or done by a 
   plugin.
 * please provide a link to your site.
 *  Thread Starter [roger17](https://wordpress.org/support/users/roger17/)
 * (@roger17)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/comments-go-to-wrong-post/#post-2884977)
 * [http://www.bollywoodjournal.com](http://www.bollywoodjournal.com)
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/comments-go-to-wrong-post/#post-2884985)
 * how is the ‘More News’ section coded?
 * might be in single.php (?)
 * make sure that all secondary queries and loops get ended with `wp_reset_postdata()`
   or `wp_reset_query()`
 *  Thread Starter [roger17](https://wordpress.org/support/users/roger17/)
 * (@roger17)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/comments-go-to-wrong-post/#post-2884987)
 * I am sorry but i am new to this coding. Can you please help me where to put wp_reset_postdata()
   or wp_reset_query() in single.php.
 * Here is my single.php
 * _[please [use the ‘code’ button to mark any posted code](http://codex.wordpress.org/Forum_Welcome#Posting_Code)–
   to keep it readable and intact – the code below is partly broken]_
 *     ```
       <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
   
       	<div class="sitenav">
       	<a>">Home</a>  »  <?php the_category(', '); ?>  »  <?php single_post_title(); ?>
       	</div>
   
       	<div id="post-<?php the_ID(); ?>" class="post">
   
       	<h1><?php the_title(); ?></h1>
   
       	<ul class="postinfo">
   
       <li><?php the_time('l, F j, Y, G:i'); ?></li>
       	<li class="ncat"><?php the_category(', ') ?>
       	<div class="clear"></div>
   
       	<div class="entry">
       	<?php the_content('Read full entry »'); ?>
       	<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
       	</div><div class="clear"></div>
   
       	<ul class="postinfoB">
       	<li class="nshare"><a href="#bookmarks">Share</a>
       	<?php if(function_exists('wp_print')) { print '<li class="nprint">'; print_link(); print ''; } ?>
       	<div class="clear"></div>
   
           <?php include TEMPLATEPATH. '/templates/more.latest.inpost.html'; ?>
   
       	<!--
       	<?php trackback_rdf(); ?>
       	-->
   
       	</div><!-- post -->
   
       <?php endwhile; ?>
   
       	<!-- navigation here -->
       	<div class="nav">
       	<div class="alignleft"><?php previous_post_link('« <strong>%link</strong>') ?></div>
   
       	<div class="alignright"><?php next_post_link('<strong>%link</strong> »') ?></div>
       	<div class="clear"></div>
       	</div>
   
       	<?php comments_template(); ?>
   
       <?php else : ?>
   
       	<!-- not found here -->
       	<?php include TEMPLATEPATH. '/templates/not.found.html'; ?>
   
       <?php endif; ?>
       ```
   
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/comments-go-to-wrong-post/#post-2884989)
 * this line:
 *     ```
       <?php include TEMPLATEPATH. '/templates/more.latest.inpost.html'; ?>
       ```
   
 * points to an template with the file name _more.latest.inpost.html _ (?) in the_/
   templates/_ subfolder of your theme;
 * either locate that file and post the code here ( how-to [http://codex.wordpress.org/Forum_Welcome#Posting_Code](http://codex.wordpress.org/Forum_Welcome#Posting_Code))
 * **or**
 * for a trial, just add
    `<?php wp_reset_postdata(); wp_reset_query(); ?>` after
   that line.
 *  Thread Starter [roger17](https://wordpress.org/support/users/roger17/)
 * (@roger17)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/comments-go-to-wrong-post/#post-2884992)
 * Thank you for guiding newcomer like me.
 * By the way,
 * I tried to put <?php wp_reset_postdata(); wp_reset_query(); ?> after
    <?php include
   TEMPLATEPATH. ‘/templates/more.latest.inpost.html’; ?> but that didn’t work.
 * So, here i am posting my ‘more.latest.inpost.html’ code.
 * [http://pastebin.com/7xfLCqG3](http://pastebin.com/7xfLCqG3)
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/comments-go-to-wrong-post/#post-2885000)
 * try to add `wp_reset_postdata();` after the `endwhile;` in that template;
 *     ```
       <?php endwhile; wp_reset_postdata(); ?>
       ```
   
 * if that does not work, keep the edit, and also try to move the `<?php endwhile;?
   >` in single.php to after the line with `<?php comments_template(); ?>`
 * and/or add some code to save and retrieve the original query before and after
   the call of the ‘more news’;
 *     ```
       <?php $temp = $wp_query();
       include TEMPLATEPATH. '/templates/more.latest.inpost.html';
       $wp_query = $temp; ?>
       ```
   
 * **ps**:
    I left a test comment on the post ‘Salman Khan’s ‘Kick’ To Go On Floors
   In November’
 *  Thread Starter [roger17](https://wordpress.org/support/users/roger17/)
 * (@roger17)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/comments-go-to-wrong-post/#post-2885009)
 * Thank you very much for your great help. The problem is solved now.
 * This worked perfectly.
 * > <?php endwhile; wp_reset_postdata(); ?>
 *  [Aline_rodrigues](https://wordpress.org/support/users/aline_rodrigues/)
 * (@aline_rodrigues)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/comments-go-to-wrong-post/#post-2885506)
 * Hi everyone,
    My problem is, when I click for submmit button the comments,the
   comments go to post related.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/comments-go-to-wrong-post/#post-2885507)
 * As per the [Forum Welcome](http://codex.wordpress.org/Forum_Welcome#Where_To_Post),
   please [post your own topic](http://wordpress.org/support/forum/how-to-and-troubleshooting#postform).
   Posting in an existing topic prevents us from being able to track issues by topic.
   Added to which, your problem – despite any similarity in symptoms – is likely
   to be completely different.

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

The topic ‘Comments go to wrong post’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 10 replies
 * 4 participants
 * Last reply from: [esmi](https://wordpress.org/support/users/esmi/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/comments-go-to-wrong-post/#post-2885507)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
