Skip Navigation

[Resolved] Using the toolset_association_created to copy a field from child post to parent

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

Problem:

How to use action hook "toolset_association_created"?

Solution:

Action hook "toolset_association_created" is triggered after two posts are connected.

Relevant Documentation:

https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_association_created

This support ticket is created 3 years 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 camila 3 years ago.

Assisted by: Luo Yang.

Author
Posts
#2230281

Hello.
I am using the toolset_association_created to copy a field from a child post (a property )to a parent post (a tax sales).

It's working but I would like to know the following:
1. When exactly does this apply: "when you make or update the relationship".
2. Is it when changes are made to the tax sale (parent) or the property (child)
3. Does it also apply if changes are made to the property? (child post)
4. I'm wondering if they create the property separately, and then link it if it might not get applied?

thanks

#2230527

Hello,

Q1) "when you make or update the relationship" means after two posts are connected.

Q2) Is it when changes are made to the tax sale (parent) or the property (child)
No, for example, this action hook "toolset_association_created" is triggered after "tax sale" post connects with "property" post

Q3) No, it does not.

Q4) I assume you are going to trigger your custom PHP codes: after user create/update a "property" post.
If it is, you can try WP built-in action hook "save_post", see WP document:
https://developer.wordpress.org/reference/hooks/save_post/

For your reference

#2230911

My issue is resolved now. Thank you!