Hi Eliot,
I am trying to update the value of an acf taxonomy field by using update_field()
if I use wp_set_object_terms() the data appears in the backend form fields but is not saved to the post until I manually save the post.
I can’t get update_field() working with any value… Should I be passing the term object or the ID?
`
//works but does not save data to the field
wp_set_object_terms( $route_id, intval( $grade_object->term_id), ‘grade’ );
//I believe this is what I need to do but I cannot get it to work
update_field(‘field_52e7f08dec08a’, intval( $grade_object->term_id) , $route_id);
Thanks
Hi!
I have the same problem. Posted an entry here yesterday:
http://support.advancedcustomfields.com/forums/topic/relationship-field-works-after-click-update/
/ Tobias
Hi Bones!
Did you manage to solve this problem yet? I have had no luck yet.
Best regards,
Tobias
Hi Tobias,
Sorry I’ve had no luck yet either. Looks like this is a bug waiting to be fixed.
B
I have found a solution!
It’s all about the output function rather than the save function.
using get_field('field_name')
wasn’t outputting a value
I needed to use get_field(field_id)
(it will look something like this – field_52d84a083f9c6
)
I generally do use field ID’s as they’re supposed to be more reliable, for some reason I used the field name here and that was causing the problem.
Hope that helps someone
Im using the field_id but i think something crazy is wrong, because it get the default “welcome to wordpress” blog post, yet i have set up the field so filter by my custom post type that i created, which it populates correcly when im updating the post and the relation field.
And when running a get_field(field id….) i get the correctly value + default wp blog post + the title of the entry repeated 21 times. No logic there.
The topic ‘using update_field for taxonomy terms’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.