Support

Account

Home Forums General Issues ubable to Update sub field by smio api plugin Reply To: ubable to Update sub field by smio api plugin

  • In order to use this other plugin you need to understand how all of the various fields in ACF are stored. Updating a field in ACF requires 2 entries in the database. One for the meta_key, which is the same as the field name and the second for the ACF field key reference.
    Example

    
                   meta key = $field_name      = the value of your field
    acf field key reference = "_{$field_name}" = the acf field key
    

    Updating a value without the field key reference will work for basic fields that only store basic text values. This includes Text, Text Area, Number, Email, URL, Password, WISIWYG

    All other fields will not work correctly if the field key reference is not in the database.

    Repeater fields are a special case. A repeater field stores many values.

    
    meta_key | value
    "{$repeater_field_name}"                            | number of rows in repeater
    "{$repeater_field_name}_{$index}_{$sub_field_name}" | value of one sub field
    

    And each has an ACF reference field

    
    meta_key | value
    "_{$repeater_field_name}"                            | field key of repeater
    "_{$repeater_field_name}_{$index}_{$sub_field_name}" | field key of sub field
    

    On top of this, depending on the type of sub field, if it is not a basic text field type then your values will also need to conform to how ACF stores the values for each of these fields.