admin管理员组文章数量:1431426
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 ] );
本文标签: tagsHow do I exclude categories from gettags
版权声明:本文标题:tags - How do I exclude categories from get_tags? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745534495a2662209.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
if
statement to skip over those 2 tags – Tom J Nowell ♦ Commented May 1, 2019 at 17:53