This morning ran into a situation where a category was excluded in a query_posts statement yet was appearing on the page anyway. It turned out the post was in two categories. One was excluded but the other was included. So WP included the post because it passed the test of being in a category that was not excluded, even though one category WAS excluded. This is a reasonable solution to this situation, but in this particular case it was the exact opposite of the behavior I needed from WP.
I played with exclude=-11 and category__not_in=11 and could not find a way to make it work. I resolved it by putting an
if (in_category('11')) continueat the top of the loop which caused WP to skip over that post and not display it, but that seemed like a kludge solution.
Wonder if anyone has worked out a solution or code for this situation.
- The topic ‘Q about excluding categories’ is closed to new replies.