Support

Account

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.