Display the Relations Meta Field in the Add New Post Form (Legacy)
Add legacy relations as a field in a JetEngine form to submit a post and automatically set related items.
Before you start check tutorial
- Elementor (Free version) or Block editor (Gutenberg)
- JetEngine plugin installed and activated
with the Relations (Legacy) configured and the Forms (Legacy) module enabled.
If you run a property listing website, storing two major custom post types – Agents and Properties. The properties are submitted through a front-end form. You would like the site users to be able to select which agent a particular property is related to via a frontend form. For that reason, you’ve created the relationships between the Properties and Agents’ CPTs. Now, it’s time to find out how you can display just the Relation meta field in the frontend form.
The answer to that is a Select field. You could add a field to the form where you want to output and choose the related posts.
Select Form Field Settings
Firstly, choose to edit the Add new post form, add a new Select field to it and configure it as follows:
Front-end Form Configuration
Then move on to the Post-submit Actions / Notification Settings section, open the Insert/Update Post notification type, and set up the Select field you’ve added previously. Find the necessary field in the Fields Map section, then choose the “Post Meta” option in the Select post property drop-down. Once there’s a new empty text area next to it, paste the relation meta key into it.
Save the changes to the field and the notification type, then update the Form. This is how the result might look on the front-end: