call child post calc function when parent post value update
-
Hello,
I’m using toolset to create custom post type fields and custom posts. I have a PHP code in a custom function.php that run some calculations using a function to the parent and a function to the child every time the post is saved (and its working just fine).
so far I couldn’t get the toolset support to resolve my issue (below) as they see it as a noon plugin issue (custom code).
I want to update the child post calculations when the parent post value is changed and saved.
my thought was to do the following:function calculate_parent ($post_ID) { run calculation code // this is working fine and no need to debug it // update child post from inside the parent function run the code to find the child posts // I have this in place call the child function to run on the child post by providing the child id (I think) // this is where the issue is } function calculate_child ($post_ID) { run child calculation by get parent custom post fields values // this is working fine }
for example I have the code below inside the function that run after the parent post is updated but i’m not sure if its correct as I dont see the child post updated correctly.
// find child post - life-insurance-need type and update $child_posts = types_child_posts('life-insurance-need'); foreach ($child_posts as $child_post) { $post_ID = $child_post->ID; calculate_li_need ($post_ID); }
I’m not sure if this is how to call the child_calc function to run from the parent.
any thoughts?
thanks,
David
The page I need help with: [log in to see the link]
- The topic ‘call child post calc function when parent post value update’ is closed to new replies.