Hi there,
I am using the "post category" field to populate the category of a post. This works well. What I would like to do though is:
if a child is chosen on the form, then the parent (or even parents) are added automatically with the help of a hook/filter. Which would be the best filter to use and how would I go about adding that parent to the post category?
In logic I would:
1. get the field value of the post category field into $child_category
2. use get_category_parent ($child_category) to save parent in $parent
3. wp_set_post_terms ($post_ID, $parent, $category, true)
Do not know if that is right though. If it is the questions I have: what do I use for $post_ID and what do I use for $category?
As always, any help is appreciated!