Support

Account

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

Helping

ubable to Update sub field by smio api plugin

  • I want to post a new post in my blog via smio WordPress api solutions plugin and want to update custom field and sub field. i can update custom field but unable to sub post field.

    https://localhost/api/newpost/?subject=just%20for%20test&content=test&categoryid=1,2,3&taxonomy=%5Blocation,20,23%5D%5Bweather,24,25%5D&custom_meta={%22size%22:%22XL%22}&custom_field={%22field_52c5adaaffb3a%22:%225%22}&comment_status=open&slug=test&tags=test,tags,post&siteid=&post_type=movie

    this is the way i want to post. but the problem is adding sub field by metakey.

    please view the section
    custom_field={“field_52c5adaaffb3a”:”5″}

    and tell me to json string by which i can add custom sub field also.

    {“customfieldmetakey”:[{“subfieldmetakey”:”value”,[{“submetakey”:”value”}]}]

    but it does not work. please help me.

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

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

The topic ‘ubable to Update sub field by smio api plugin’ is closed to new replies.