I am passing a variable $category to category__and, and it works unless $category = 0;
'category__and' => array(4) // works
'category__and' => array($category, 4) // works if category > 1
'category__and' => array(0, 4) // does not work.
I originally tried to just use cat, but if the post has cat 4 and NOT cat 6, it will still show it. This is why I went to category__and.
'cat' => '4,6' // will show a post with category 4 even if 6 isn't present
I could write a conditional to check the value of $category but that seems unnecessary and I think I'm overlooking something.
Aucun commentaire:
Enregistrer un commentaire