Support

Account

Home Forums ACF PRO using update_field for taxonomy terms

Solved

using update_field for taxonomy terms

  • 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 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.

  • Hi @jpegtobbe

    Can you please post your code?

    Cheers
    E

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘using update_field for taxonomy terms’ is closed to new replies.