I'm using a function that I think it uses this code to get the tags from a taxonomy:

if($taxonomy){ $tags = get_terms( $taxonomy, 'order=ASC&hide_empty='.$show_empty.'');

As it is, is extracts all the tags(parent & child) from that taxonomy. But what I need is to extract only the parent or child tags from a specific tag_ID(14).

I've tried to include child_of=14 and parent=0 but couldn't make it. Could you give a advice?

  • What do you mean by "only the parent or child tags"? Aren't the two mutually exclusive?
    – s_ha_dum
    May 13, 2014 at 14:40
  • yes, or one or another. Tried both ways and cannot make it work. What I would prefer is to get only top parent tags.
    – Pipeline
    May 13, 2014 at 14:42

1 Answer 1


The parent argument should do what you are asking.

(integer) Get direct children of this term (only terms whose explicit parent is this value). If 0 is passed, only top-level terms are returned. Default is an empty string.


That is parent=14 should get all of the immediate children of term 14, but no grandchildren or great-grandchildren. If that is not working I have to assume that a plugin or something in your theme is interfering, or I have completely misunderstood your problem.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.