Wordpress - Check if a post has any term in this custom taxonomy?

You can have the term input empty, e.g.

if( has_term( '', 'genre' ) ) {
    // do something
}

to see if the current post object has any terms in the genre taxonomy.

It uses is_object_in_term() where:

The given terms are checked against the object’s terms’ term_ids, names and slugs. Terms given as integers will only be checked against the object’s terms’ term_ids. If no terms are given, determines if object is associated with any terms in the given taxonomy.


if ( has_term('', 'genre') ) {
    // whether it's jazz, blues, rock and roll; doesn't matter as long as the post has any of them.
}

would return true if the post contains any term in the genre taxonomy