Support

Account

Home Forums General Issues How to use update_field($field_taxonomy, $term_taxonomy, $post_id)? Reply To: How to use update_field($field_taxonomy, $term_taxonomy, $post_id)?

  • So… The Support replied: “…you will need to pass the $term object to the $value parameter of the function”. Ok. Lat’s do it now!

    Inside “acf/save_post”:

    $current_user = wp_get_current_user();
    update_field('_user', $current_user, $post_id); // user_obj, but don't work, why is it?
    update_field('_user', $current_user->ID, $post_id); // just ID, but works fine
    $status_term_obj = get_term_by('slug', 'created', 'request_status'); // it's term_obj
    update_field('_status', $status_term_obj, $post_id); // don't work!

    In Debuger update_field() looks:
    http://prntscr.com/b0hup1

    The Tax_Term_Obj there is, but the Field_Obj is “null”. Why?

    Here is this field: http://prntscr.com/b0hzo4 and that field_group is added to post_type=”request”.

    Maybe it’s important: fields “_user” and “_status” in fields_group “Request Admin Part” and they don’t show in acf_form() and set in code “acf/save_post”.