You cannot set it automatically, but you can display the Taxonomy Term name, or slug, or others, on the CRED Form.
With this information, it's easy for the user of your form to fill the form correctly.
Or, you could even populate a Generic Single Line Field with this Term Information, and then use it when you submit the Form, with a CRED API hook, to wp_set_post_terms() the Term of the newly submitted post.
1. This is how you display the Term of the Parent Post on the CRED Form that creates the Child Post:
- Create your Parent/Child relationship
- Create the Form that creates the Child Posts.
- Make sure, it includes a ShortCode for the parent post term as this example:
[wpv-post-taxonomy type="category" format="slug" id="[wpv-search-term param='parent_toolset-type_id']"]
==> We get the term slug of the post with id equal to the search term that CRED Child Post Forms add to the URL
- Add the "Create Child Post" Link to the actual Parent Post
- Add the "Create Child" FORM to any page and make sure, "Create Child Post" Link links to it
- When you now click on the "Create Child Post" Link you will get a URL like:
<em><u>hidden link</u></em>
- You will also see the Slug of the Term assigned to the parent Post on the CRED Form!
2. How to use the parent post term to populate a Generic Field and update the post with the term on submit:
- Insert a CRED generic Single Line Field to the form and populate the value with this:
[wpv-post-taxonomy type="category" format="slug" id="[wpv-search-term param='parent_toolset-type_id']"]
- Add a CRED API hook that gets the above Field value from the $_POST
- The same hook now should wp_set_post_terms() the new post with the value you got from $_POST
DOC:
https://developer.wordpress.org/reference/functions/wp_set_post_terms/
hidden link
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data