Support

Account

Home Forums Feature Requests REST API Reply To: REST API

  • Looking at your code over there, the biggest thing that I see when it comes to ACF is that you’re using the field name when updating the ACF fields.

    When a post and the ACF field values does not previously exist, using update_field() using the field name will fail because ACF does not know what to do with the value.

    When using update_field() in this situation you need to use the field key instead of the field name.

    You could also use update_post_meta() and add everything that ACF will need. When ACF adds a value to the field it inserts 2 rows in the database:

    
    meta_key       | meta_value
     {$field_name} | $value
    _{$field_name} | $field_key