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:
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.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users