Even though individual Tags, Categories and Taxonomies are all represented as WP_Term
objects, WordPress has three separate conditional tags for sorting them out: is_tag()
, is_category()
and is_tax()
. These are sometimes combined into a single conditional statement in WordPress core, and there are plenty of examples on GitHub where developers have created an umbrella is_term()
function like this:
function is_term($term = '') {
return is_tag($term) || is_category($term) || is_tax($term);
}
It would be nice to have that function added to WordPress core.