JetFormBuilder Connect Relation Items Not Working: Parent-Child Fix

When JetFormBuilder's Connect Relation Items action is not working, the cause is usually one of three things. The form sends the wrong ID as the Parent Item ID, the Child Item ID is not the post the form just created, or the actions run in the wrong order. To fix it, run Insert/Update Post first. Then add Connect Relation Items after it with inserted-post-id as the Child Item ID, and take the Parent Item ID from a field that really holds a parent post ID.
If the link saves but the parent's Listing Grid shows every child post, jump to the Listing Grid section. The examples use parent CPT Properties, child CPT Inspections and a One to Many relation. They use the current JetFormBuilder and JetEngine Relations UI, not the legacy JetEngine > Forms builder.
- How a one-to-many relation decides which side is the parent
- Form 1: create the parent post
- Form 2: add a child post and connect it in the same submit
- Where does the parent ID come from? Three setups
- Show only this parent's children in a Listing Grid
- Children inside tabs or inside a parent listing
- Troubleshooting checklist
How a one-to-many relation decides which side is the parent
Every JetEngine relation has a parent object and a child object. For "one property has many inspections", set it up like this:
- Parent object: Properties.
- Child object: Inspections.
- Relation type: One to Many.
Open the relation in JetEngine > Relations and check the direction before you build any form. If it was registered the other way round, you have to swap every ID below.
- Parent Item ID: the ID of a Properties post.
- Child Item ID: the ID of an Inspections post. In a create-and-connect form, that is the post the form just inserted.
For the field that picks the parent, use a Select or Radio field. Both let the user choose one option, which fits One to Many. A Checkbox field allows several options and matches Many to Many.
Before you start:
- JetEngine and JetFormBuilder must both be active.
- The relation must already exist.
- Field names must be unique within a form. Use only lowercase Latin letters, with
-or_between words and no spaces (for exampleparent_property).
If your relation links users rather than posts, see linking users to a CPT on the front end.
Form 1: create the parent post
A new property has no inspections yet, so this form does not touch the relation. The link is made later, from the child side.
- Go to JetFormBuilder > Add New.
- Add a Text field named
property_title, plus any other fields you need. - In Post Submit Actions, add Insert/Update Post. Set Post Type to Properties and Post Status to Published.
- In the Fields Map, map
property_titleto Post Title.
No Connect Relation Items action is needed here.
Form 2: add a child post and connect it in the same submit
- Go to JetFormBuilder > Add New and add a Text field named
inspection_title. - Add the field that carries the parent ID and name it
parent_property. Its type depends on where the form sits (see the next section). - In Post Submit Actions, add Insert/Update Post. Set Post Type to Inspections and Post Status to Published.
- In its Fields Map, map
inspection_titleto Post Title. Leaveparent_propertyon "Select post property", because the parent ID is not a property of the new post. - Click + New Action and add Connect Relation Items below the Insert/Update Post action. Set:
- Relation: your Properties to Inspections relation.
- Parent Item ID: the
parent_propertyfield. - Child Item ID:
inserted-post-id, the ID of the post the previous action created. - Update Context: leave it empty.
- How to Store the New Item: choose the option that fits your setup. The official guide linked below describes the options.
- Save the form and submit a test entry.
The order matters. Connect Relation Items needs the inserted post ID, and that ID exists only after Insert/Update Post has run. For every setting, see the official JetFormBuilder guide to connecting related items.
Where does the parent ID come from? Three setups
(a) Form on the Properties single template: Hidden Field with Current Post ID
Add a Hidden Field named parent_property and keep its default value, Current Post ID. It returns the ID of the post where the form is placed. On the Properties single template, that is the property being viewed, so it is the correct Parent Item ID.
(b) Form on a separate page: Select or Radio filled from Properties
Add a Select or Radio field named parent_property. Set Fill Options From to Posts and Post Type to Properties. The user picks the property. The selected value is the property's post ID, which you map as the Parent Item ID.
(c) Link from the property to a form page: Hidden Field with URL Query Variable
Use this when the property's page sends visitors to a separate form page.
- On the Properties single template, add a button that links to your form page with the property's ID in the URL, for example a link ending in
?property_id=123. Build the link with a JetEngine Dynamic Link or a dynamic tag that outputs the current post ID. The exact option differs between setups, so confirm it in your JetEngine version. - On the form page, add a Hidden Field named
parent_propertyand choose URL Query Variable. - In the variable name setting your version shows, enter the same parameter name as the link (
property_idhere). If you don't see that setting in the field, check the Hidden Field's Dynamic Tag "Edit Preset" pop-up, which also lists URL Query Variable as a SOURCE.
To confirm it works, open a property, click the button and check that the form page URL contains the property's ID. Then submit a test inspection and check that it appears on that property.
Why setup (a) breaks on a normal page
Current Post ID always means "the post that holds this form". On a regular page it returns that page's ID, not a property's. The inspection gets created but is linked to nothing or to the wrong object. If the form has to live outside the property's single template, use setup (b) or (c).
Show only this parent's children in a Listing Grid
A Listing Grid that only has Inspections as its post type shows every inspection on the site. To limit it to the current property's inspections, filter the query with the Related Items macro.
- Go to JetEngine > Query Builder > Add New. Choose the Posts Query type and set Post Type to Inspections.
- In the Post & Page section, click the macros icon next to Post In and choose Related Items.
- Set From Relation to your relation, From Object to Child Object, and Initial Object ID From to Current Object ID.
- Open the macro's Advanced settings and set Fallback to a non-existent ID such as
0. Save the query. - Open the Properties single template and add a Listing Grid that uses your Inspections listing item.
- In the Listing Grid's Custom Query section, enable Use Custom Query and select the query.
Open two properties on the front end. Each should list only its own inspections. With the fallback set, a property with no inspections shows none. Without the fallback, the macro finds nothing and the query usually returns every inspection, which looks exactly like an unfiltered grid.
The current relation macros work with relations created after the JetEngine 2.11.0 update. Legacy relation macros work only with legacy relations, so a macro copied from an old tutorial will not filter a newer relation. The JetEngine relations macros page covers both. For other query pitfalls, see our JetEngine Query Builder mistakes and fixes.
Children inside tabs or inside a parent listing
The Initial Object ID From setting decides which object the macro starts from:
| Option | Which object it uses | Use it when |
|---|---|---|
| Current Object ID | The current post on a single page, or the current item when the grid sits inside another listing | The grid is placed directly on the property's single template, or nested inside a Properties listing so each item shows its own inspections |
| Default WordPress Object (for current page) | Always the page's global object, even inside a listing added to that page | The grid sits inside a listing item of another post type on the property's page and must always follow the page's own property |
If the grid sits inside tabs, test which option returns the right property in your setup. The docs only describe the difference for listings.
If you need the macro as text, for an SQL query for example, generate it in WordPress Dashboard > JetEngine > JetEngine > Macros Generator by choosing Related Items. The output looks like %rel_get_items|23|child_object|current_object|%. Crocoblock's SQL example adds a fallback: %rel_get_items|23|child_object|current_object|%{"fallback":"0"}. The 23 belongs to the example relation, so generate your own macro instead of editing the number. To combine children from two relations in one grid, follow Crocoblock's several-relations guide.
Troubleshooting checklist
| Symptom | Cause | Fix |
|---|---|---|
| Child post is created but linked to nothing or to the wrong parent | A Hidden Field with Current Post ID on a normal page returns the page ID | Move the form to the Properties single template, switch to a Select/Radio filled from Properties, or pass the ID in the URL and read it with URL Query Variable |
| Relation is not saved on a create-and-connect form | Wrong Child Item ID, Update Context filled in, or actions in the wrong order | Set Child Item ID to inserted-post-id, leave Update Context empty, and place Insert/Update Post above Connect Relation Items |
| Parent and child are swapped | The Parent Item ID field holds an Inspections ID, or the relation was registered the other way round | Swap the two fields in the action, or fix the relation's parent and child objects |
| Existing links disappear after an edit form | A filled Fields Map in Insert/Update Post makes new related items replace the old ones. Unticking a pre-ticked child also disconnects it. | In relation-update forms, leave the Fields Map empty. Unticking removes the link by design. |
| Listing shows every child post | One of three causes: the Listing Grid is not using the Related Items query; the macro has no fallback, so a parent with no children returns all posts; or a legacy macro is used on a current relation | Enable Use Custom Query and pick the query. Set the macro fallback to a non-existent ID such as 0. Use the current Related Items macro. |
| A grid inside a listing item of another post type on the property page shows the wrong parent's children | Current Object ID takes the current listing item, not the page's property | Use Default WordPress Object (for current page). Keep Current Object ID for grids nested in a Properties listing. |
| Listing shows nothing | The same query is set as the listing template's source and again in the Listing Grid's Custom Query tab | Keep it in one place only |
Find the symptom you see in the table. Then test with one property that has inspections and one that has none. If you would rather have this flow built for you, post a request on BoostMyCroco.
Frequently Asked Questions
Can I link one child post to several parents with JetFormBuilder checkboxes?
Does the old JetEngine > Forms relation setup still work?
Why does my related posts listing work on one site but not another?
Why does a parent with no children show every child post?
How do I check that the relation was saved after submitting the form?
This guide answers a question from our community: Is someone able to help me tweak my forms connection to listings?
Sources
- JetFormBuilder: Connecting WordPress Related Items with Post Submit Actions (jetformbuilder.com)
- Macros for WordPress Relations — JetEngine (crocoblock.com)
- Displaying Related Items From Several Relations in One Listing — JetEngine (crocoblock.com)
- How to Connect Relation Items Using Forms (crocoblock.com)
- Hidden Field Overview ㅡ JetFormBuilder (jetformbuilder.com)


