Archived Posts in Wrong Category

The problem is almost assuredly your custom loop.

I am guessing that this is your problem:

$category = get_the_category($post->ID);
$category = $category[0]->cat_ID;

Further, I’m guessing that the $post object being queried here has more than one category term defined. Thus, $category[0] is returning something other than “tutorials”.

Easiest solution: ensure all posts only have one category term defined.

More complex, but more future-proof and stable, solution: eliminate the use of the Category Post List Widget Plugin, go back to using the default query loop, and define your markup/style as necessary for your archive index pages.

Leave a Comment