Ok im not sure if I have worded the title right but basically I have posts in custom categories and I want to get the current post category and do something.
So for example: if current post is in tag_id 15, say ‘your in the category vegetarian’
this is what im using:
any help would be great, thank you
WordPress has a built in function for this:
in_category( $category, $_post )
(used inside the loop):That’s good for a specific use case. If you always want it to spit out your “You’re in the [category] category” for every category, including future ones, you would use
get_the_category( $id )
like this example (inside the loop).