I’m struggling with this and the documentation doesn’t really make it clear…
I have the following field types in a field group placed on a Taxonomy “company”…
How do I save values in to those checkboxes?
$org_id_prefixed = 'company_'. $organisation->term_id;
already gives the prefixed ID.
Elsewhere, I’m successfully using the following to save to a Checkbox that is NOT in a Group…
// Save "tags" (array) in ACF "org_tags" (checkbox)
update_field('org_tags', $json_string->tags, $org_id_prefixed);
What I want to save to org_cat_sector
is $json_string->category->sector
Most of the documentation around update_sub_field
refers to Repeater. I’m unclear if I need to use have_rows
stuff.
The following…
update_sub_field(
array(‘org_categories’, 1, ‘org_cat_sector’), // Selector
$json_string->category->industryGroup, // Value
$org_id_prefixed // Object ID
);
… results in PHP throwing: ( ! ) Warning: Invalid argument supplied for foreach() in /home/myfolder/public_html/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-checkbox.php on line 490
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.