Check whether post is in a list of categories
-
Hi all
I had this line of code in a plugin I am developing:
if in_category($the_categories) { ... }
This works fine as long as $the_categories is something like “7” or “1001”. But as soon as it is a list of categories, like “7,1001”, it does not work any more.
So, how do I achieve this? Note that I cannot use
if (in_category($category1) || in_category($category2) )
…because I want to build a widget where the user can input a list of categories like “7,1001” (which then is used for the conditional tag.
Thanks!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Check whether post is in a list of categories’ is closed to new replies.