Skip Navigation

[Resolved] View – Button Link to create new post with relationship to current post in view

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/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 1 year, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#2604993
Screenshot 2023-05-10 233238.png

Tell us what you are trying to do?

I am attempting to create a view that includes links to manage other post types. My view currently displays "Request" post types, and a button for each request should be designed to create a new "Inspection" post type, and automatically include this new post in a one-to-many relationship with the current "Request" post displaying in the view.

When clicking "Create Report", I would like that to create a new "Inspection" post and automatically link it to the "Request" post id in the current view.

The "View/Edit" link is what displays and automatically links to the current relationship post when an "Inspection" post is already in a relationship with the listed "Request" post.

Is there any documentation that you are following?
No, can't find much on this thought.

Is there a similar example that we can see?
See included image.

Let me know if there is anything else I can clarify.

~ Alex T

#2605081

Hello,

You can try these:
1) Create two post types:
- Request
- Inspection

2) Setup one-to-many relationship between "Request" and "Inspection"

3) Setup a post form for creating new child "Inspection" post,

4) In single "Request" post, display above child post form with parent "Request" preselected:
https://toolset.com/course-lesson/selecting-parent-posts-when-using-forms-to-create-child-items/
section "Creating Forms with a Parent Post Preselected"