Home › Forums › General Issues › How can I display a specific field value from a linked(relationship/object)post? › Reply To: How can I display a specific field value from a linked(relationship/object)post?
Are you saying that, given your example, in the Edit Product screen for “Product 1” there would be a field with the text “Open”? And this field is set to the company_status field of an associated company?
If that’s the case, I would do something like this:
1. Associate Products to Companies (already done).
2. Create a “company_status” field on Company cusotm post type.
3. Create a “product_company_status” field on Product custom post types.
4. Use the update_value hook to detect the Company’s company_status field getting updated. See the Update_value() documentation.
5. In the hook function, find all products that are associated with that company. Then loop over all Products and update the “product_company_status” field with the new “company_status”. See the update_field() documentation.
Now whenever a “Company” post’s has it’s company_status value updated, the hook function will fire, updating all products. I hope that makes sense.
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.