I am searching how to exclude posts from displaying in a loop if them are in a category x, but not in many categories…
The Problem: if I do exclude posts i.e. out of category 5, all posts are listed in category 5 will be excluded. Also those which are also in category 3 and 1.
how do i exclude:
while (have_posts()) : the_post();
if(in_category($myCatsToExcludeArray)) continue;
...
... some general outputs
endwhile;
All you’ll need to do is count() the get_the_category() results to determine how many categories your post is in, and check it along with your in_category().
For example: