Skip Navigation

[Resolved] Connecting a child post to a draft parent post

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

Problem:

The issue here is that the user wanted to connect their draft parent posts to child posts.

Solution:

This can be done by following the instructions that the customer did in the link below.
https://toolset.com/forums/topic/connecting-a-child-post-to-a-draft-parent-post/#post-1139761

This support ticket is created 6 years, 2 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 2 replies, has 2 voices.

Last updated by emmaM-2 6 years, 2 months ago.

Assisted by: Shane.

Author
Posts
#1137501

Hello,

I have a content template for a CPT called Listing, which has a parent-child relationship with Related Projects.

Users create draft Listings which need to be approved prior to changing the status to publish. While the Listing is in draft the user needs to add Related Projects.

On the content template for Listing I have inserted a cred form to add a related project. The user can add a Related Project, but the new child record is not connected to the parent.

I have temporarily placed the join field on the form so that I can see if it is being connected to the parent record:

[cred_field field="@listing-related-project.parent" class="form-control" output="bootstrap" select_text="--- not set ---" author='$current']

The dropdown only displays Listing posts that are published. Could this be why the child posts are not being connected to the parent?

I've reviewed this documentation:
https://toolset.com/documentation/post-relationships/how-to-build-front-end-forms-for-connecting-posts/

It doesn't mention whether there is a prerequisite that the parent post be published. Is there a hack I can use so that a child post can be connected to a draft parent post?

(Or am I missing something else entirely??)

Emma

#1137795

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Emma,

Thank you for contacting our support forum.

Unfortunately this is not mentioned but it is a requirement that the parent post be set to published if you want to attach a child to it.

There isn't a hack that exist that you can use to achieve this that i'm aware of.

Thanks,
Shane

#1139761

Hi Shane,

Perhaps this should be on the features list for development?

We've worked out a way to achieve the desired result. The form is nested on the Content Template and the url contains the ID of the parent post. We've added "urlparam='p'" to the shortcode:

[cred_field field="@listing-related-project.parent" class="form-control" output="bootstrap" select_text="--- not set ---" author='$current' urlparam='p']

This is working.

Emma