Category__And not working — selects offset of desired value
-
I have come across something very odd: I am doing a custom query and I need to select posts that belong in TWO categories. So, I’m using the “category__and” query option.
$args['category__and'] = $my_array;
However, it was producing inaccurate results. So, I did some debugging and have printed out my SQL. Here’s an example of what’s happening.
Desired categories = 157 and 141
In the SQL, this is what I see:
WHERE term_taxonomy_id IN (140,156)
How bizarre is this? If I change the selected categories, it always actually uses the category minus 1. I’ve printed out my array right before, to make sure I’m not actually giving it the wrong numbers… but the array is fine:
Array ( [0] => 157 [1] => 141 )
Is this a bug with “category__and”? Am I misunderstanding how this should work? Any help would be appreciated.
Thanks!
- The topic ‘Category__And not working — selects offset of desired value’ is closed to new replies.