This is driving me crazy, and I have tried a variety of different things. Essentially, the desired effect is to target two different categories in Wordpress using the built in in_category
function.
Here is my code as it stands currently:
if(in_category( array("Snacks", "Other Nuts") )) :
//do something
endif;
This will work with the category Snacks
but not with the category Other Nuts
. When I replace Other Nuts
with another category name, like Confections
, it works perfectly.
I am assuming this has something to do with the space in the category name Other Nuts
. Though, I have tried using it's category ID and category slug to no avail.
Any idea what's going on here??