Support

Account

Home Forums Backend Issues (wp-admin) Field value update using update_field doesn’t show on backend… Reply To: Field value update using update_field doesn’t show on backend…

  • “your group field is, for some reason, being confused for a repeater”

    You get it! I sincerely appreciate the response. I believe acf/load_value would work, as acf/update_value works. I’ve just had some issues consistently accessing $field[‘key’], and in any case it really complicates the code. If we can get update_field working, that would be ideal. I’d really like to make sure I’m not misunderstanding anything before going any further with the plugin I’m working on, so I want to avoid workarounds. If you think I’ve misunderstood, please explain.

    After looking and looking, I have become fixated on the group in the field registration because I can’t find any documentation for how to register this…
    https://www.advancedcustomfields.com/resources/group/
    …via php.

    So now, I’m not sure how I came up with this…

    
    array(
    	'key' => 'field_q3md98zvnm241',
            'label' => 'Additional Information',
            'name' => 'additional_information',
            'type' => 'group',
            'sub_fields' => array(
    

    …outside of intuition. You say it looks right and it mostly works. It looks fine on the backend post editor. Something I forgot to mention is that when recalling the information that’s been manually saved, get_field works fine.

    
    $activeAddtlDetails = get_field('additional_information', $post_id);
    $activeOwnerName = $activeAddtlDetails['owner_name'];
    

    $activeOwnerName returns the owner name that was saved in additional_information_owner_name postmeta.

    Does this offer any clues?

    I should also mention that this…

    
    update_field('field_4v8yw6n2hbpqs', $old_owner_name, $post_id);
    

    …in place of the update_sub_field creates…

    
    owner_name | Another Test Owner Name
    _owner_name | field_4v8yw6n2hbpqs
    

    I think it’s interesting that either way it’s creating new postmeta rows with the correct information from the registered field, disregarding it’s placement in the schema.