Skip Navigation

[Resolved] Add repeatable custom field from custom post type to post form

This support ticket is created 4 years, 4 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 – 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 3 replies, has 2 voices.

Last updated by Luo Yang 4 years, 4 months ago.

Assisted by: Luo Yang.

Author
Posts
#1780583

Tell us what you are trying to do?

I have a Artist custom post type and an Exhibition custom post type. I have connected them by a many-to-many Relationship (i.e. many Exhibitions can have many Artists). I am using a Post Form to add a new Exhibition and need the custom field of Artist Name to show up in the "Add New Exhibition" Post Form as a repeatable field since one Exhibition can have multiple Artists.

Currently, when I create the "Add New Exhibition" Post Form, none of the fields from the Artist Field Group show up for me to add Artist Name into the "Add New Exhibition" Post Form. Secondly, I can't use Artist as a Post Reference and as a repeatable field in the "Add New Exhibition" Post Form.

Is there any documentation that you are following?

I tried the following but again, when I create the "Add New Exhibition" Post Form based on the Exhibition custom type created, with a relationship already set between Artist and Exhibition, it did not work:

https://toolset.com/course-lesson/front-end-relationship-forms-for-connecting-posts/
https://toolset.com/course-lesson/how-to-set-up-post-relationships-in-wordpress/
https://toolset.com/course-lesson/front-end-relationship-forms-for-connecting-posts/

Is there a similar example that we can see?

In the above documentation Venues and Events explains it. One venue has multiple events, just as one exhibition has multiple artists. In my Post Form to Add a New Exhibition, I should have a linking field Artist Name that links to Artist Custom Post Type and is repeatable so I can add multiple Artists to one Exhibition.

I also checked: https://toolset.com/documentation/legacy-features/views-plugin/using-post-reference-fields-to-display-information-from-a-related-post/

But when I add the Post Reference to Artists in the Field Group for Exhibitions and then try to make it repeatable, I get a pop up asking to set a many-to-many relationship between Artists and Exhibitions, which I have already done and even when the Preview Change and popup is okayed, the Post Reference gets automatically removed from the Custom Fields.

#1781103

Hello,

Since you are using many-to-many relationship, it can not be setup within post form, you will need to follow the document you mentioned above to setup the relationship form and connect posts with each other.
https://toolset.com/course-lesson/front-end-relationship-forms-for-connecting-posts/

The workflow looks like below:
1) Create a Exhibition post
2) Create a Artist post
3) Setup a relationship form
4) In the single Exhibition post, display above relationship form for connecting other Artist posts

#1783069

I completed all these steps, but I need help with the following:

I have an "Add Exhibition" Post Form that adds an exhibition (custom type) with custom fields. I want to be able to add Artist Name, a field from Artist custom post type as a repeatable. With a Post Reference I am able to link the Artists already in the system and the field on the frontend shows up as a dropdown that automatically lists the Artist posts by Artist Name.

My question to you is: In the Add Exhibition Post Form, how do I get Artist Name as a repeatable field to display all the Artist Name values already input into the Artist Custom Post Type, the way they do via Post Reference?

I am easily able to add Artists to the Exhibition post type within the system, but I need to be able to do this using a Post Form via frontend submission.

#1783575

The Post Reference field is based on one-to-many relationship, so you can use it in the post form, but in your case, it is many-to-many relationship, the it is different, you can not setup the many-to-many relationship with post form, see my first answer above:

you will need to follow the document you mentioned above to setup the relationship form and connect posts with each other

https://toolset.com/course-lesson/front-end-relationship-forms-for-connecting-posts/