Hello,
Thanks for the feedback!
I just ran some tests using your report information, and it works fine on my end. Here is the video of my test.
Are you using your update_field()
in a specific hook? Can you please share your code & context?
Thanks!
Regards.
I think I figured it out. I was running the function after a form submission which creates a post. Inside of the update_value function within the taxonomy term field class there is a conditional check to where it only updates the post if not doing acf/save_post. So yeah, update_field doesn’t work if you run it on a post action.
Hello!
Okay I see. Yes, this behavior is the same for the native ACF Taxonomy Field. The code logic during the update is the same for both ACF Taxonomy & ACFE Taxonomy Terms fields.
Here is a video showing the same issue with an ACF Taxonomy field on a front-end form submission with a manual update_field()
in a hook.
Here is the code I used:
add_action('acfe/form/submit/post/form=my-form', 'my_form_submit', 10, 5);
function my_form_submit($post_id, $type, $args, $form, $action){
// acf taxonomy field with save/load terms
update_field('taxonomy', array(1,2), $post_id);
}
It doesn’t work either, because both fields check if the hook acf/save_post
has not been already processed before updating the terms. Which is the case when a front-end form is submitted.
The logic might be enhanced here, but that means finding a universal solution for both fields types. I don’t really know if that’s possible at the moment. I’m adding it on my todo list.
I hope this answers your question.
Have a nice day!
Regards.