Home › Forums › ACF PRO › Cross Reference Relations › Reply To: Cross Reference Relations
Hi Proacfelie,
It’s totally possible, the right way (and the easier way) to do it depends on what you exacly need : Display relationship on frontend / backend ? Do you used simple relations field or in repeater ?.
If your in the worst case, Designer and Project posts have both several relationship in repeater and you want to edit and display in backend and frontend (hope it’s will be understandable) :
Use the WP save_post action. If you save a Project ( Do with If and get_post_type()) loop on your “Designer” repeater field, and for each “Designer” input you found get and loop on the “Project” repeater field of your Designer post. If the project is already in do nothing, otherwise use acf function to update the field and add a new “Project” row. Do the same when want to save the Designer name in the Project post when saving a Designer post.
There are proper ways to do it if you don’t need the two repeater and/or if you want to query post based on repeater field key.
If you need other solution or code example tell it.
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.