If I understand right, you can create child posts in cred forms so that the user 1. chooses from all the parents, 2. chooses from own custom post parents, 3. the parent is chosen ready in select (defined by page where user is or where she/he comes from).
Now I have child posts which can't be created in parent post page (too much info on one page). Also one has to be able to create a child post from menu link, not be forced to go to parent first and then to child form page. So I'm trying to create that menu link, which somehow can carry the parent information within. Or how should I approach this?
Anyway what I need is a child post form page which has the parent post already defined (and hidden) and this page should be reachable from menu. BTW the parent posts are restricted, the current author can create only one parent, so what would work also: predefined would be current logged in author's parent post.
Hello. Thank you for contacting the Toolset support.
If you know the parent ID (as you acknowledge that there will be only one post available as parent post), based on the current author we can query the post type to find out the post belongs to current author and then we can connect that found post ID and set it as parent to the child post.
Thank you Minesh. I was wondering if it was possible to add the url parameter of parent into the menu link. The menu link is normally like this hidden link
and it should be hidden link
So the XXX part should come dynamically as shortcode. Do you think this could be done?
I wonder why you want to add the parent ID as URL param if we able to know the parent but if its not known yes, you will require to pass it as URL param.
If you can explain me the flow where exactly you want to navigate from where to where and where exactly you want to add URL param then I can guide you in the right direction.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
The above code will find the parent post ID based on the current author and add the parent ID as url param.
Now, once you login as user "testing" and click on the link Oma profiili->Uusi teos, you will see the parent ID set with URL param and the parent is selected automatically.
Can you please confirm it works at your end as well.
Wow, perfect! My issue is resolved now. Thank you Minesh so much!
EDIT: I try to reopen this, because the code doesn't work as expected at the real site as it does in clone site. Now it seems the reopening here doesn't work 🙂
That is why I edit this closing.
Hi Minesh, sorry to open this again. Now that I insert the code into the real site, for some reason it doesn't work. I can't figure out, what must be changed. I added the code to the Toolset Settings Custom code as in clone site and checked the form and the menu are the same. Did I miss something?
Hi Minesh, sorry but I can't make it work in the real site as in clone site. I have copied the code to Settings-Custom code and checked the form + menu, they are the same. What am I missing?
Can you please make sure that you activated the code snippet you added to "Custom Code"
As well as the menu names are correct. If you can send me access details to your live site with access details of test user I'm happy to look whats going wrong.
I have set the next reply to private which means only you and I have access to it.
I'm so sorry for spamming the forum with reopening, you can delete those messages. For some reason they didn't show up. Anyway I haven't added the custom code before myself, so I didn't realize there was this activate feature. Everything works perfectly now! My issue is resolved now. Thank you!