I had a categories with subcategories. After reorganize all categories, remove the subcategories and move post from some categories to other categories (with Bulk Move plugin), some categories in category.php show wrong content, mixing post from two categories.
For example, category "mistery" show post from "history, mistery". If I search one of these post that are showing incorrect in two categories, the assigned category is correct at wordpress backend
Other categories show posts correctly.
I think that this error it is happening with old subcategories.
Can somebody help me? Thank you.
This is my actual code loop in categories.php
<!-- loop de post normales-->
<?php
wp_reset_query();
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$category = get_the_category($post->ID);
$category = $category[0]->cat_ID;
query_posts(array(
'post_type' => 'post', // You can add a custom post type if you like
'paged' => $paged,
'posts_per_page' => 9,
'category__in' => array($category)
));
?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<article class="col-sm-6 col-lg-6 bottomMargin27">
<a class="noLine" href="<?php the_permalink();?>">
<?php the_post_thumbnail('fb') ?>
<div class="articleContainer">
<h4 class="articleTitle"><?php the_title(); ?></h4>
</div>
</a>
</article>
<?php endwhile; ?>
<?php wp_pagenavi(); wp_reset_query(); ?>
<?php else : ?>
<?php endif; ?>
<!-- / fin del loop de post normales -->
Try rewriting the query like this
query_posts(
array(
'post_type' => 'post',
'paged' => $paged,
'posts_per_page' => 9,
'cat' => $category // This is new
));