Count posts per taxonomy else change taxonomy if less than x number
$taxonomy = $tag-count 3 ? 'post_tag' : 'category';
$cats_or_tags = $tag-count 3 ? $tag_ids : $cat_ids;
$args = array(
'tax_query' = array(
array(
'taxonomy' = $taxonomy,
'field' = 'id',
'terms' = $cats_or_tags
The first part of this ternary works when checking the count of posts in a specific tag but the 2nd part doesn't.
It's supposed to set the taxonomy and terms values if there's more than 3 posts tagged otherwise when less than 4, display posts from categories instead of tags.