How to check if a post “does not have term” in conditional statement?

We know that we can check if the particular post has a term by using this code:

has_term('term', 'taxonomy', $post->ID )) {

I was wondering if there is a code to check if a particular post does not have a particular term.
Thanks.

2 Answers
2

if ( !has_term('term', 'taxonomy', $post->ID )) {

Use the NOT (!) operator

Leave a Comment