Wordpress next_post_link/previous_post_link not staying in same category
<p>Here's my setup.</p>

<p>single.php</p>

<pre><code>&lt;?php

    if ( in_category( 'my-category' ) ) {
        include( TEMPLATEPATH.'/single-my-category.php' );
    }
    else {
        include( TEMPLATEPATH.'/single-generic.php' );
    }
?&gt;
</code></pre>

<p>single-my-category.php</p>

<pre><code>&lt;?php

if ( have_posts() ) : while (have_posts()) : the_post(); ?&gt;

&lt;?php echo the_title(); ?&gt;

&lt;div class="pagination"&gt;
    &lt;div class="container"&gt;
        &lt;div class="row"&gt;
            &lt;div class="next col-xs-6 col-sm-6 col-md-6 col-lg-6"&gt;
                &lt;?php next_post_link( '%link', '&lt;img src="' . get_template_directory_uri() . '/img/cs-left.png" /&gt; PREVIOUS', true ); ?&gt;
            &lt;/div&gt;

            &lt;div class="previous col-xs-6 col-sm-6 col-md-6 col-lg-6"&gt;
                &lt;?php previous_post_link( '%link', 'NEXT &lt;img src="' . get_template_directory_uri() . '/img/cs-right.png" /&gt;', true ); ?&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;

&lt;?php endwhile; endif; ?&gt;
</code></pre>

<p>This is what i have followed - <a href="http://codex.wordpress.org/Function_Reference/next_post_link">http://codex.wordpress.org/Function_Reference/next_post_link</a></p>

<p>I'm not quite sure what I'm doing wrong here as for some reason the previous_post_link is taking me to a post in a different category even though in_same_term parameter of the function is set to true.</p>

<p>Any ideas?</p>

<p>Thanks.</p>