Home › Forums › ACF PRO › Bidirectional Relationships and multiple post types › Reply To: Bidirectional Relationships and multiple post types
A bit more info on how to achieve this (using shawnrosspeters example) with Post-2-Post without any code tweaking:
With ACF Post-2-Post, this can be done simply by:
– Create a custom field group for Team CPT
– Set the field group to be visible only on Team CPT
– Create there the field “Related Players” and give it the fieldname “players-teams”
– Filter by Post Type = Player CPT
– Create a custom field group for Player CPT
– Set the field group to be visible only on Player CPT
– Create field “Related Teams”
– Reuse the same fieldname as for Team CPT Related Players (“players-teams”)
– Filter by Post Type = Team CPT
* With this method, you will have a different field label for each of the 2 different custom post types.
* The filtering will only to show results of the other CPT when selecting posts for the relationships.
* By virtue of using the same fieldname “players-teams” in both field group fields, the Post-2-Post plugin works perfectly, ensuring that the bidirectional relationships are established.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
The most recent ACF Chat Friday featured a live demo of how to register CPTs directly in the plugin, one of our most requested features. Check out the summary below for a replay of the demo, and don’t forget to register for the next session! https://t.co/k2KQ3WWBAz— Advanced Custom Fields (@wp_acf) March 9, 2023
© 2023 Advanced Custom Fields.