How to set the parent (relation) to the child post from the frontend form?
One way to do that is to create a form for Child posts and display it on a Single template for Parent posts. It will have a required One to Many relation if you insert the relation meta key in the right field of the Form. To get started, please stick to the routine below.
Create a post types relation
Make sure that you do have the necessary post types to be interrelated. If not, create them. We’ll be referring to these two: Country & Tour. To create a relation, go to JetEngine > Relations and set the One to Many relation as shown below:
Create a test form
Go to JetEngine > Forms > Add New and create a form that allows adding a new post from the frontend:
In the Post-submit actions, configure the notification type like so:
The relation meta key can be taken from here:
Display the form on the frontend
Open the Tour CPT and find the necessary single page template.
If it doesn’t exist, you need to create it either in the Elementor theme builder or in the Crocoblock theme builder:
Display the newly-created test form:
Fill in the form
On the frontend, try filling out the added form and press the “Add new post” button:
Go to the backend and check out the result. You’re done!