Hello, can someone help me with this please, i’m stuck for weeks:
I have 2 acf fields:
First is ‘brands’ of type checkboxes that i populate dynamically with a list of choices.
Second is ‘brand’ of type select that I want to populate dynamically with values that where checked in the brands checkbox.
All good if I change data from post, but when I want to add values to them from an import script that I have, some problems shows up:
with thie line of code:
I added the selected checkboxes. it’s working but when the add_filter is called to populate the brand field with brands selected checkboxes is not working and I print_r the brands field object in add_filter for brand, this is the output:
[type] => text
[order_no] => 1
[required] => 0
[id] => acf-field-
[class] => text
[conditional_logic] => Array
[status] => 0
[allorany] => all
[rules] => 0
[formatting] => html
So way is the field like this? Any ideas? Tips something are all welcome.Thanks!
When populating fields with an import tool it or script it needs to be an import that understands how ACF fields are saved. It isn’t the field value but another hidden custom field that is a pointer for ACF to understand what type of field it is.
Let’s say that your field name is “field_name”. The database will have 2 entries. The first is your field name with your value and the second will be “_field_name” and the value of this field is the ACF field key for this field. It gets more complex for some types of fields.