Skip Navigation

[Resolved] Associate custom fields to two post type

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 7 replies, has 2 voices.

Last updated by Minesh 1 year, 8 months ago.

Assisted by: Minesh.

Author
Posts
#2615211

I have two post types course and class, relationship between course and class are course 1-N class, there is a custom field group assign to course by default, now I want to assign this custom field group to class also, when I do the relationship, I got below message, what does it mean?

The Post Type of this Field Group cannot be changed as long as a Repeatable Group or a Post Reference field is used.

Please advise how I can assign one custom field group to two post types?

#2615403

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please share screenshot of edit custom field group page.

As the message shows, you must have a repeating field group or post reference field is added to your existing custom field group that you want to assign to multiple post types.

#2616155
Screenshot 2023-06-15 at 11.19.17 PM.png
Screenshot 2023-06-15 at 11.18.46 PM.png

Screenshot attached.

#2616343

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

what you should do is, create a custom field group and use this custom field group to add repeating field group so this custom field group is used to hold only repeating field group.

And create another custom field group where you should add multiple custom fields as desired and assign this custom field group to use with multiple post types.

Having said that you will require two custom field groups, one to hold repeating field group exclusively and another one to hold only custom fields.

#2616699
Screenshot 2023-06-18 at 12.09.49 PM.png
Screenshot 2023-06-18 at 12.05.03 PM.png

Refer to the screenshot, my Post Field Group only contain the Repeatable Group without other custom fields, I want this be associated with two custom post ( course and class ), please advise the step.

#2616875

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Ahh ok.

Repeating field group is managed as one-to-many post relationship internally so you can not assign it to multiple post types.

If you want to do that then you should create a many to many post relationship between ( course and class ) and with the intermediary post you should add the custom fields you want that will link the custom fields you add to intermediary post type to both course and class.

Please check the following doc:
=> https://toolset.com/course-lesson/many-to-many-post-relationships/#setting-up-many-to-many-post-relationships

#2617297

Dear Minesh,

Relationship between course and class should be one to many, a class mean a subject but not a level of study, I don't understand why you suggest adding many to many post relationship between ( course and class ).

A course consist the training materials and materials are repeatable field because I don't know how many materials the course will have, after I associate the course to a specific class, then the students can access all the materials associated with this course, of course sometimes there are additional materials for individual class. Not sure whether you can understand what I want.

Best regards,

Kelvin

#2617497

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

As I understand - you want to apply one repeating field group to multiple post types - is that correct?
If yes, that is why I asked to to create many to many post relationship and the fields you add to repeating field group should be part of intermediary post type of many to many post relationship.

As repeating field group is managed as one to many post relationship that is why you can not assign one repeating field group to multiple post types.

You will have to create another repeating field group and when you try to add custom field to that repeating field group you can click on the button "Add custom field" and with the popup you see you can further click on the button "Choose from previously created fields" that will allow you to add/use the same custom fields you assign to previously created repeating field group.