Skip Navigation

[Resolved] Create post relation on form submit

This thread is resolved. Here is a description of the problem and solution.

The customer asked how to create a post-relationship when a form to create a new post is submitted.

Guided that this will require a custom function, attached to the "cred_save_data" hook, and will use the "toolset_connect_posts" function to connect the two posts.

Relevant Documentation:

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by ferryv-3 10 months, 1 week ago.

Assigned support staff: Waqar.


Dear support team,

Tell us what you are trying to do?

I want to automatic create a post relation between 2 posttypes when the second posttype post is created on the page of the first already existing post.

Is there any documentation that you are following?

no. (yes but i coudn't find much, see below ) Also not even sure where to put the code. functions.php is my best guess atm. figured i need the toolset_connect_posts hook but i cant really find how and where in the documentation.

Also because the new post will only get an id after saving it, the hook should probably trigger after the saving.
The documentation:

// Connect a custom Author post with the ID of "5" to a custom Book post with the ID of "7" in a post relationship between Books and Authors
toolset_connect_posts( 'book-author', 5, 7 );

Is there a similar example that we can see?

My users need to be able to make a offer to an item on the first posttype. This should link them together with a relationship so i can show the highest bids and follow up with the user.

Thanks in advance,




Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Ferry,

Thank you for contacting us and I'd be happy to assist.

Your understanding is correct and to connect the newly created post with the post where the new post form is used, you'll need a custom function.

The function will be attached to the "cred_save_data" hook ( ref: ), and will use the "toolset_connect_posts" function ( ref: ) to connect the two posts.

You'll find a relevant example code snippet in this reply:



Hi Waqar,

Thanks!! Working like a charm!



My issue is resolved now. Thank you!