I have this function
$tags = get_tags( array('exclude' => 11, 12) )
Which excludes specific tags 11 and 12. But without manually having to add each tag ID I don't want shown, how do I exclude the category that these tags are coming from?
I have this function
$tags = get_tags( array('exclude' => 11, 12) )
Which excludes specific tags 11 and 12. But without manually having to add each tag ID I don't want shown, how do I exclude the category that these tags are coming from?
Share Improve this question edited May 1, 2019 at 17:44 harshclimate asked May 1, 2019 at 17:38 harshclimateharshclimate 217 bronze badges 5 |2 Answers
Reset to default -1Since this question is too hard to ask, I'm going to use custom taxonomies. Thanks for your help so far, everyone.
You could get all of the term IDs for the badcategory
and use those in your exclude filter:
$bad_terms = get_terms( [ 'taxonomy' => 'badcategory', 'fields' => 'ids' ] );
$good_tags = get_tags( [ 'exclude' => $bad_terms ] );
if
statement to skip over those 2 tags – Tom J Nowell ♦ Commented May 1, 2019 at 17:53