Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

When save a term which is a child term, if I don't provide specific parent id, will WP make this term's parent 0 ?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

When you create a term for a hierarchical taxonomy, if you don't specify a parent, its parent ID is set to 0. In other words, it becomes a parent term.


Edited with regards to comments:

  • Add specifically each term you wish to add to the post (parent terms aren't automatically added if their children are).
  • Adding terms to posts does not effect the terms relationship with each other (i.e.. child-parent relationship remains in tact).
share|improve this answer
    
the term already created as a child of another term. Now I want to assign the child to a post. –  Jenny Jul 7 '12 at 15:07
    
so you want to know if you need to provide the ID of the taxonomy term's parent along with the child term? Do you want to add both child and parent terms to the post? –  Stephen Harris Jul 7 '12 at 15:12
    
I want to add child term to the post, not care the parent being added or not, but want the child term's parent always be the same. –  Jenny Jul 7 '12 at 15:13
    
Edited my answer - does that answer your question? :) –  Stephen Harris Jul 7 '12 at 15:16
    
thanks, that helps! –  Jenny Jul 7 '12 at 15:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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