If you use custom post types, you’ll often have the need to do something if the current post has a specific term from a custom taxonomy.
You can accomplish this using the following:
All you need to do here is change the TERM to the name of the category within the custom taxonomy (exactly what you’ve called it, include spaces etc) and then add the name of the custom taxonomy.
The above snippet will then only echo out the code when the term is present in the current post.
This little snippet is best used if:
If you are planning to have lots of terms (categories) we would suggest using the built-in WordPress categories, as these are a lot easier to work with.
Don’t forget that we offer WordPress support for any issue you have with WordPress. If you need help, just get in touch.Get help with your WordPress site