Skip Navigation

[Resolved] Auto-Create a relationship between two custom post types

This support ticket is created 6 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 1 reply, has 2 voices.

Last updated by Minesh 6 years, 10 months ago.

Assisted by: Minesh.

Author
Posts
#603325
Screen Shot 2018-01-04 at 09.44.49.jpg
Screen Shot 2018-01-04 at 09.47.00.jpg

I would like to create a relationship between my two custom post types 'client' and 'dog' in the front-end using a form by formidable forms

I have successfully setup relationships between the two custom post types in the backend by using the new toolset betas for types and views. The relationships work correctly.

I have found the following info on the web:
https://toolset.com/forums/topic/meta-for-post-relationships/

But I am not sure how to make my form write to it.

Or: is there a way to allow a front-end user the same functionality as in the admin section of the cpt (see screenshot below)? If my frontendusers could add dogs directly from the front-end like that and they would get connected automatically to him that would be perfect.

Sorry, it's a local site at the moment.

#603357

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - As we just released the M2M Beta, there is still lot of work to be done and lot of changes will be expected before be release the stable official release. Also, there is no API available yet to connect the post automatically.

I recommend you to use current stable Types (All Toolset) plugins for now and build your relationship using current stable Types version as to use Beta is not recommended.

To connect parent and child with current stable version, When using Types posts relationships, the parent of a given type is stored in a field:

_wpcf_belongs_{parent-posttype-slug}_id

For example:
Let’s assume that we are displaying a "Car" (child) post type that has a "Maker" (parent) as a parent post type.
- Each Car (child) post will store its Maker (parent) id in the field: _wpcf_belongs_maker_id