I am trying to: Let the post form select and save parent CPT using CRED select field.
Link to a page where the issue can be seen: hidden link
I expected to see: The post created by this form becomes linked to its parent as it used to do before toolset types 3.0 update.
Instead, I got: Parent not saved.
I have a CPT called packages (slug:package) which is parent to child CPTs called package orders (slug: packageorder) in a one to many relationship. I have a CRED form displayed on the parent page (package) (seen in the link) that creates package-orders. The form used to work properly before the very much appreciated toolset 3.0 update. The code I used to link select the parent field was "_wpcf_belongs_" which is now legacy as I understand and stopped working after the update (the migration tool warned me).
I changed the tool to the new format and the code for the parent select field now looks like this:
<div class="form-group">
[cred_field field='@package-order.parent' select_text='--- not set ---' value='[wpv-post-id]' class='form-control' output='bootstrap']
</div>
The field correctly selects the parent package automatically (as seen in screenshot) but does not save it. So the child post (package order) is created correctly with all the fields of the form correctly saved except that it is not linked to its parent package (despite being correctly shown in the form prior to submission).
Strangely enough, I have another post form on the same site (created after the update) linking two parent and child posts (services and service orders) with exactly the same setup as packages and package orders and using exactly the same code (below) and it is working properly and saving the parent correctly !!
<div class="form-group">
[cred_field field='@provider-service-order.parent' select_text='--- not set ---' value='[wpv-post-id]' class='form-control' output='bootstrap']</div>
This is driving me crazy. What am I missing here?
I forgot to add that in an attempt to fix this, I deleted the package to packageorders relationship and recreated it with the new relationships option but it still did not work.
By now, you deleted the entire Toolset Relationship and recreated it with the new methods - is this correct?
This is a new situation for me, as it's not supposed to be deleted/recreated.
New methods save their relations differently and only legacy (migrated) relations will continue to save the data that way.
To help you best I need a status update on the current situation so I could try to replicate this or show you how to proceed.
To create a Child Post of a given (current) parent in a Legacy (and migrated) relationship you are not supposed to change anything, since we put backwards compatibility in place for exactly that field - and those post relations will continue to hold that value as well!
So now it is possible that there is a little mixup on the site - where the same relation maybe holds both kind of data.
Do you have a backup from before you migrated?
If so we could use that and steps you'd provide, to try to replicate this and fix it if it's replicable
For new forms, this is the DOC:
https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/
Yes, that syntax changed, but if you created those forms earlier and used them on existing relations, no update should be required to that code as we put backwards compatibility in place.
Can you let me know at where we are now on your site, and eventually add log in data so I can see it directly?
Hi, our developers have released an update, Types 3.0.1, which resolves some issues related to parent post assignment. Please find the latest version at https://toolset.com/account/downloads, and install it manually. Then review the functionality of this form and confirm things are being related correctly in wp-admin. If not, I will be glad to take a closer look.
Hello Christian. Am sorry for my delayed response. I didn't have the opportunity to test your suggestion. I manually installed types 3.0.1 but unfortunately the problem remains the same: the form in question still did not link the child post to its parent although the parent select field is displaying the correct parent.
Okay thank you, I was able to create a clone of your site and reproduce the problem with only Toolset plugins and WPML CMS active, and I don't see anything obviously wrong. I will escalate this to my second tier support team for additional investigation. Please stand by and I will let you know what I find out.
Thank you Christian. I appreciate your help.
Any updates on this issue or temporary workarounds?
Hi, I haven't received any workaround for this issue yet, but I will reach out to my 2nd tier support team again right now and let them know you are checking in. If anything is available I will let you know as soon as I can.
Dear Christian,
I want to update you on something I discovered just now. I revisited an older part of the website where I add packages (child) to providers (parent) and it used to work properly before Types 3.0 (using ofc the old code "_wpcf_belongs"). Now this is having the same issue as described above (the package post is created but not linked to its parent although the parent is shown correctly in the relational field in the CRED frontend (Post form name: Add Package). I tried changing the relational code to the new format "@provider_package.parent" but it still didn't register the parent provider.
I did not delete or modify that package-provider relationship. So I thought this is important to report since Beda suggested that recreating the relationship in my previously reported problem (package-package orders relation) might be the cause, which is clearly not in this case.
I am not sure if it is something related to 'Packages' since it is the CPT in common in both defective relationships.
Thanks for the additional information, I will pass that to my 2nd tier investigation team.
Another update: I made a repeatable field group called 'gallery' for the provider CPT which is added through a CRED frontend post-form called "Provider gallery" id 2809 .. again it is showing the parent provider in the CRED form but not registering it. I think this problem is more wide-spread that I initially thought. Most of my site is affected.
Thanks, I will pass that information along as well.
Hi just a quick update to let you know we have escalated this issue to our developers for resolution, and I'm standing by for an update from them. I'll keep you posted as I receive more information.