Skip Navigation

[Resolved] Reuse Custom Field

This thread is resolved. Here is a description of the problem and solution.

Problem:

Setup relationship between users and custom post types.

Solution:

For example, you can create a custom post type "Member":

https://toolset.com/forums/topic/reuse-custom-field/#post-1281463

Relevant Documentation:

https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-one-related-item-parent

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

Last updated by paulB-10 4 years, 9 months ago.

Assisted by: Luo Yang.

Author
Posts
#1281257

I have a number of custom fields that I want to use in a number of post types. e.g. a list of tournaments.
it can be used for player registration (post type) to nominate for a team and it can be used for nominating coaches and managers in another post type.
When you define a custom field you have to assign a CPT for it, otherwise, it is global. This does not work Great if you are trying to build up a hierarchy of fields, essentially an object.
e.g. A person's name is really first name + last name and you will always put them together so I would like to have a field
"Person Name" but not assign it to a post type in the custom field.
When I create a custom post type, create a custom field for the entire CPT e.g. Coach Nominations.
and create a Coach Nomination Custom field in which I would include person name.

See the following example.
CPT Coach Nominations
Custom Field -> Coach Nominations
includes Person Name (custom field) Not assigned to any post.
comprises First Name, Last Name

CPT Player Registrations
Custom Field -> Player Registration
includes Person Name (custom field) Not assigned to any post
comprises First Name, Last Name.

I have thought of creating a dummy CPT that comprises all custom fields but is just a holding object but I am sure there is a better solution.

Thank you in advance for your assistance and guidance.

#1281463

Hello,

In your case, I don't think there is other better solution.

For example, you can create a custom post type "Member", with custom fields
- Person Name
...

Setup one-to-many(or one-to-one) relationship between post type "Member" and "Coach Nominations",
In a single "Coach Nominations" post, you can display the related "Member" post information by above relationship, see our document:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-one-related-item-parent

#1281595

I will take on board the advice for future development of the website.
Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.