Skip Navigation

[Resolved] toolset_association_created for new posts

This support ticket is created 5 years, 4 months 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.

This topic contains 1 reply, has 1 voice.

Last updated by simon 5 years, 4 months ago.

Author
Posts
#1320435

I've added some custom php to copy a featured image from the parent post to the child post of a 1-many relationship. When the relationship is created, I assign the featured image to the child post:

set_post_thumbnail( $child_id, $parent_thumbnail_id )

This works fine except one case, where the child post does not exist, I add a new child, associate the child with the parent, then publish. If I publish first, then associate the child it works fine.

In all cases the toolset_association_created action is raise correctly and I get post ids for both parent and child, but I cannot set post thumbnail if the child post is not already saved. I'm guessing the child post is not created and perhaps is draft. Any thoughts as to how I might be able to do this consistently.

#1320437

My issue is resolved now. Thank you!