add_filter('acf/save_post' , 'acf_save_post_type_filter', 20 );
function acf_save_post_type_filter($post_id) {
// We have been called from the action_log post type
if (get_post_type($post_id) == 'action_log'){
// What is the ID of the associated post_type?
$associated_id = get_field('associated_id', $post_id);
// Update the field in the associated post type
update_field('action_completed', 'Yes', $associated_id);
}
}
When I try and use this code it returns false and does not update the associated field.
Thoughts?
Thanks John. Looks like the forum is working. Did you remove the post?
More info …
The field exists.
If you call the function from the post type the field exists in you can update the field.
I can use get_posts to retrieve data from the second post type I am trying to save to.